![](/media/cache/group/220px-Herndon_Monument_Climb.jpg.50x50_q85.jpg)
Start of project 2
Dependencies: Motor Servo mbed mbed-rtos
main.cpp@3:50cee0fef078, 2018-10-10 (annotated)
- Committer:
- nhersom
- Date:
- Wed Oct 10 12:26:05 2018 +0000
- Revision:
- 3:50cee0fef078
- Parent:
- 0:9347308e8e1a
- Child:
- 4:a3e95c9d56d5
Motor code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
m215676 | 0:9347308e8e1a | 1 | #include "mbed.h" |
m215676 | 0:9347308e8e1a | 2 | #include "stdio.h" |
m215676 | 0:9347308e8e1a | 3 | #include "Motor.h" |
m215676 | 0:9347308e8e1a | 4 | #include "math.h" |
m215676 | 0:9347308e8e1a | 5 | |
nhersom | 3:50cee0fef078 | 6 | Motor m(p26,p30,p29); |
nhersom | 3:50cee0fef078 | 7 | DigitalIn fire (p16,p17,p18,p19,p20); |
m215676 | 0:9347308e8e1a | 8 | |
nhersom | 3:50cee0fef078 | 9 | int main() |
nhersom | 3:50cee0fef078 | 10 | { |
nhersom | 3:50cee0fef078 | 11 | fire.read; |
nhersom | 3:50cee0fef078 | 12 | if (fire==1) { |
nhersom | 3:50cee0fef078 | 13 | while(1) { |
nhersom | 3:50cee0fef078 | 14 | m.speed(1); |
nhersom | 3:50cee0fef078 | 15 | wait (.15); |
nhersom | 3:50cee0fef078 | 16 | m.speed(0); |
nhersom | 3:50cee0fef078 | 17 | wait (1); |
nhersom | 3:50cee0fef078 | 18 | break; |
nhersom | 3:50cee0fef078 | 19 | } |
nhersom | 3:50cee0fef078 | 20 | while(1) { |
nhersom | 3:50cee0fef078 | 21 | m.speed(-.25); |
nhersom | 3:50cee0fef078 | 22 | wait(.6); |
nhersom | 3:50cee0fef078 | 23 | m.speed(0); |
nhersom | 3:50cee0fef078 | 24 | wait(1); |
nhersom | 3:50cee0fef078 | 25 | break; |
nhersom | 3:50cee0fef078 | 26 | } |
nhersom | 3:50cee0fef078 | 27 | } |
nhersom | 3:50cee0fef078 | 28 | |
m215676 | 0:9347308e8e1a | 29 | } //end of int main |