04-05 PWMDCMotor
From Manuals
(Difference between revisions)
(Created page with 'The example program uses a PWM output to control a servo motor. The servo motor is a HiTEC HS0422 /*Program Example 4.5: PWM control to DC motor is repeatedly ramped …') |
|||
| Line 1: | Line 1: | ||
The example program uses a PWM output to control a servo motor. The servo motor is a HiTEC HS0422 | The example program uses a PWM output to control a servo motor. The servo motor is a HiTEC HS0422 | ||
| + | The PWM signals for the MBED-SDK and the Bambino line of microcontrollers are mapped to the following connector locations: | ||
| + | {| border="1" cellpadding="5" cellspacing="2" align="center" style="text-align: center;" | ||
| + | |+ align="bottom"|'''Signals Used and Connector Locations for Example 04-05''' | ||
| + | |'''PWM Signal''' | ||
| + | |'''LPC4330 PIN NAME''' | ||
| + | |'''BAM210E''' | ||
| + | |'''BAM210''' | ||
| + | |'''BAM200E''' | ||
| + | |'''BAM200''' | ||
| + | |- | ||
| + | |PWM1 | ||
| + | |P1_7 | ||
| + | |J9-3 | ||
| + | |J9-3 | ||
| + | |S2-3 | ||
| + | |S2-3 | ||
| + | |- | ||
| + | |} | ||
| + | |||
| + | The following schematic can be used to build the circuit with a BAM210E or BAM210. | ||
| + | [[Image:BAM210_04_05_SCH.png|center|alt=BAM210|frame|<div align="center">'''Schematic for example 04-05''']] | ||
| + | |||
| + | <div style="text-align: left;"> | ||
/*Program Example 4.5: PWM control to DC motor is repeatedly ramped | /*Program Example 4.5: PWM control to DC motor is repeatedly ramped | ||
*/ | */ | ||
| Line 19: | Line 42: | ||
| + | The following image shows the built circuit on a BAM210E. | ||
[[Image:BAM210_PWMDCMotor.jpeg|center|]] | [[Image:BAM210_PWMDCMotor.jpeg|center|]] | ||
| - | |||
| - | |||
| - | |||
| - | |||
Revision as of 18:51, 17 September 2014
The example program uses a PWM output to control a servo motor. The servo motor is a HiTEC HS0422
The PWM signals for the MBED-SDK and the Bambino line of microcontrollers are mapped to the following connector locations:
| PWM Signal | LPC4330 PIN NAME | BAM210E | BAM210 | BAM200E | BAM200 |
| PWM1 | P1_7 | J9-3 | J9-3 | S2-3 | S2-3 |
The following schematic can be used to build the circuit with a BAM210E or BAM210.
/*Program Example 4.5: PWM control to DC motor is repeatedly ramped
*/
#include "mbed.h"
PwmOut motor(PWM1);
float i;
int main()
{
motor.period(0.010); // set PWM period to 10 ms
while(1) {
for (i=0; i<1; i=i+0.01f) {
motor=i; // update PWM duty cycle
wait(0.2);
}
}
}
The following image shows the built circuit on a BAM210E.


