-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DC Motor Support #257
DC Motor Support #257
Conversation
…ut direction control
I have named the classes back to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, Leandru has successfully implemented the MotorController, MotorHelper, and application.yml. The files have been placed correctly, with MotorController in the inputdevice folder and MotorHelper in the outputdevice folder.
import jakarta.inject.Named; | ||
|
||
//tag::ex[] | ||
@Controller("/DCMotor") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All methods from the MotorHelper.java class and every single line in MotorController look great!
@@ -35,6 +35,13 @@ pi4j: | |||
provider: pigpio-pwm | |||
initial: 0 | |||
shutdown: 0 | |||
dc-motor: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The structure in application.yml looks great! I’m just curious—could the address be a different number? Is it possible to choose the address randomly?
* Switches the direction of the DC motor. | ||
*/ | ||
public void switchDirection() { | ||
setClockwise(!isClockwise); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well written description of each method and well implemented them as well.
…, fixed bug with motor speed checking
The direction setting is now complete and the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Developed MotorHelper.java for DC motor control using the Pi4J library, including methods for initialization, PWM speed control, and direction change (forward/reverse), with example controller on how to use MotorHelper.java with GPIO pin configuration integrated via YAML
Fixes Issue #255. Added helper and controller classes for a DC motor. The classes can control a DC motor's speed. Planned are direction controls (forward/reverse) and tests for the helper class.
The structure of the code added follows the basic set structure for adding components to the repository:
application.yml
specifies what pins to use for the motor, the helper class is added underpi4micronaut-utils
, and the controller class is added undercomponents/controllers
.I chose to rename the
MotorController.java
as specified in the issue description toDCMotorController.java
to more easily differentiate it from the similarly named servo motor component.