by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
main.cpp
- Committer:
- robt
- Date:
- 2012-08-31
- Revision:
- 0:76b527fa897e
File content as of revision 0:76b527fa897e:
/*Program Example 4.5: PWM control to DC motor is repeatedly ramped */ #include "mbed.h" PwmOut PWM1(p21); float i; int main() { PWM1.period(0.010); //set PWM period to 10 ms while(1) { for (i=0; i<1; i=i+0.01) { PWM1=i; // update PWM duty cycle wait(0.2); } } }