Page 282 - ARM Based Microcontroller Projects Using MBED
P. 282
268 9. MOTOR CONTROL PROJECTS
FIG. 9.10, CONT’D
configured as input. Three functions are developed: StopMotor, RotateClockwise, and
RotateAntiClockwise. At the beginning of the program the motor is stopped. Inside the main
program the state of the User button is checked and if the button is pressed then the motor is
rotated clockwise, otherwise it is rotated anticlockwise.
9.3.7 Suggestions for Additional Work
In this project the motor speed is the same when the motor is activated. Modify the program
giveninFig.9.10bysendingPWMwaveformtothemotorandchangethespeedofthemotorby
changing the Duty Cycle of this waveform. Try setting the Duty Cycle to 25%, 50%, and 100%.
9.4 PROJECT 3—SIMPLE SERVO MOTOR CONTROL
9.4.1 Description
In this project a small servo motor is connected to one of the GPIO ports of the Nucleo-
F411RE development board. The servo motor is controlled as follows:
• position the servo moor all the way to the right (0degrees)
• wait for 3s
• position the servo motor all the way to the left (180degrees)
• wait for 3s
• position the servo motor in the middle (90degrees)
9.4.2 Aim
The aim of this project is to show how a servo motor can be controlled.