A sample of library "Motor_LockedAntiphase"
Dependencies: Motor_LockedAntiphase mbed
main.cpp@0:cc2d257ecd53, 2014-04-23 (annotated)
- Committer:
- spiralray
- Date:
- Wed Apr 23 16:38:24 2014 +0000
- Revision:
- 0:cc2d257ecd53
A sample of library "Motor_LockedAntiphase"
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
spiralray | 0:cc2d257ecd53 | 1 | #include "mbed.h" |
spiralray | 0:cc2d257ecd53 | 2 | #include "motor_lockedantiphase.h" |
spiralray | 0:cc2d257ecd53 | 3 | |
spiralray | 0:cc2d257ecd53 | 4 | PwmOut motora(PA_0); |
spiralray | 0:cc2d257ecd53 | 5 | PwmOut motorb(PA_1); |
spiralray | 0:cc2d257ecd53 | 6 | Motor_LockedAntiphase motor(motora,motorb); |
spiralray | 0:cc2d257ecd53 | 7 | |
spiralray | 0:cc2d257ecd53 | 8 | DigitalOut myled(LED1); |
spiralray | 0:cc2d257ecd53 | 9 | |
spiralray | 0:cc2d257ecd53 | 10 | int main() { |
spiralray | 0:cc2d257ecd53 | 11 | |
spiralray | 0:cc2d257ecd53 | 12 | motor.period_us(50); //20kHz |
spiralray | 0:cc2d257ecd53 | 13 | |
spiralray | 0:cc2d257ecd53 | 14 | while(1) { |
spiralray | 0:cc2d257ecd53 | 15 | myled =1; |
spiralray | 0:cc2d257ecd53 | 16 | motor =1.0; |
spiralray | 0:cc2d257ecd53 | 17 | wait(1); |
spiralray | 0:cc2d257ecd53 | 18 | myled = 0; |
spiralray | 0:cc2d257ecd53 | 19 | motor = 0; |
spiralray | 0:cc2d257ecd53 | 20 | wait(1); |
spiralray | 0:cc2d257ecd53 | 21 | } |
spiralray | 0:cc2d257ecd53 | 22 | } |