This is a program to drive a stepper servomotor from SerialUSB without any other interrution but the serial one.
main.cpp@0:da3eb35a2787, 2012-04-09 (annotated)
- Committer:
- Yo_Robot
- Date:
- Mon Apr 09 03:10:30 2012 +0000
- Revision:
- 0:da3eb35a2787
version0.2 PTO using Timer2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Yo_Robot | 0:da3eb35a2787 | 1 | // This code is for controlling a bipolar stepper motor |
Yo_Robot | 0:da3eb35a2787 | 2 | // using an L293D driver |
Yo_Robot | 0:da3eb35a2787 | 3 | |
Yo_Robot | 0:da3eb35a2787 | 4 | #include "mbed.h" |
Yo_Robot | 0:da3eb35a2787 | 5 | #include "config.h" |
Yo_Robot | 0:da3eb35a2787 | 6 | |
Yo_Robot | 0:da3eb35a2787 | 7 | Serial pc( USBTX, USBRX ); |
Yo_Robot | 0:da3eb35a2787 | 8 | |
Yo_Robot | 0:da3eb35a2787 | 9 | void Setup_PTO_Timer2(); |
Yo_Robot | 0:da3eb35a2787 | 10 | void ISR_Serial(); |
Yo_Robot | 0:da3eb35a2787 | 11 | |
Yo_Robot | 0:da3eb35a2787 | 12 | int main() { |
Yo_Robot | 0:da3eb35a2787 | 13 | |
Yo_Robot | 0:da3eb35a2787 | 14 | Setup_PTO_Timer2(); |
Yo_Robot | 0:da3eb35a2787 | 15 | pc.attach( &ISR_Serial ); |
Yo_Robot | 0:da3eb35a2787 | 16 | |
Yo_Robot | 0:da3eb35a2787 | 17 | while(1) { |
Yo_Robot | 0:da3eb35a2787 | 18 | |
Yo_Robot | 0:da3eb35a2787 | 19 | |
Yo_Robot | 0:da3eb35a2787 | 20 | } |
Yo_Robot | 0:da3eb35a2787 | 21 | } |