coding for the sub
Dependencies: mbed Motor Servo
main.cpp@4:6feb04db3086, 2018-10-09 (annotated)
- Committer:
- m211734
- Date:
- Tue Oct 09 12:41:59 2018 +0000
- Revision:
- 4:6feb04db3086
- Parent:
- 1:f3f36258eaab
- Child:
- 5:9825fb56de59
added stuff
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
m211734 | 0:d59f674faf5e | 1 | #include "mbed.h" |
doubleJ312 | 1:f3f36258eaab | 2 | #include "stdio.h" |
doubleJ312 | 1:f3f36258eaab | 3 | #include "stdlib.h" |
doubleJ312 | 1:f3f36258eaab | 4 | #include "Motor.h" |
doubleJ312 | 1:f3f36258eaab | 5 | #include "Servo.h" |
m211734 | 0:d59f674faf5e | 6 | /* this is the code for the sub |
m211734 | 0:d59f674faf5e | 7 | */ |
m211734 | 0:d59f674faf5e | 8 | |
m211734 | 0:d59f674faf5e | 9 | |
doubleJ312 | 1:f3f36258eaab | 10 | Motor m(p26, p30, p29); |
doubleJ312 | 1:f3f36258eaab | 11 | Servo myservo(p22); |
doubleJ312 | 1:f3f36258eaab | 12 | float pedal; |
m211734 | 0:d59f674faf5e | 13 | |
m211734 | 0:d59f674faf5e | 14 | int main() { |
doubleJ312 | 1:f3f36258eaab | 15 | while(1){ |
doubleJ312 | 1:f3f36258eaab | 16 | for (pedal=0; pedal<=1 ;pedal+=.25){ |
m211734 | 4:6feb04db3086 | 17 | m.speed(pedal*0.5); |
doubleJ312 | 1:f3f36258eaab | 18 | pedal = 0; |
doubleJ312 | 1:f3f36258eaab | 19 | myservo = pedal; |
doubleJ312 | 1:f3f36258eaab | 20 | //printf("%f", pedal); |
doubleJ312 | 1:f3f36258eaab | 21 | wait(0.25); |
doubleJ312 | 1:f3f36258eaab | 22 | } |
m211734 | 0:d59f674faf5e | 23 | } |
m211734 | 4:6feb04db3086 | 24 | } |