project2
Dependencies: Motor Servo mbed
main.cpp@0:be1f12b9b509, 2015-10-16 (annotated)
- Committer:
- thetstone
- Date:
- Fri Oct 16 00:35:20 2015 +0000
- Revision:
- 0:be1f12b9b509
- Child:
- 1:23be1a2c3357
project 2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thetstone | 0:be1f12b9b509 | 1 | #include "mbed.h" |
thetstone | 0:be1f12b9b509 | 2 | #include "Motor.h" |
thetstone | 0:be1f12b9b509 | 3 | #include "Servo.h" |
thetstone | 0:be1f12b9b509 | 4 | #include "math.h" |
thetstone | 0:be1f12b9b509 | 5 | #include "stdlib.h" |
thetstone | 0:be1f12b9b509 | 6 | #include "stdio.h" |
thetstone | 0:be1f12b9b509 | 7 | |
thetstone | 0:be1f12b9b509 | 8 | BusIn switches(p19, p18, p17, p16); |
thetstone | 0:be1f12b9b509 | 9 | Motor m(p25, p27, p28); |
thetstone | 0:be1f12b9b509 | 10 | Servo servo_1(p); |
thetstone | 0:be1f12b9b509 | 11 | Servo servo_2(p); |
thetstone | 0:be1f12b9b509 | 12 | servo_1.calibrate(.0009,90); |
thetstone | 0:be1f12b9b509 | 13 | servo_2.calibrate(.0009, 90); |
thetstone | 0:be1f12b9b509 | 14 | float a; |
thetstone | 0:be1f12b9b509 | 15 | float b; |
thetstone | 0:be1f12b9b509 | 16 | |
thetstone | 0:be1f12b9b509 | 17 | int main(void) { |
thetstone | 0:be1f12b9b509 | 18 | servo_1 = .5; |
thetstone | 0:be1f12b9b509 | 19 | servo_2 = .5; |
thetstone | 0:be1f12b9b509 | 20 | a = rand()/(float)RAND_MAX; |
thetstone | 0:be1f12b9b509 | 21 | b = rand()/(float)RAND_MAX*4; |
thetstone | 0:be1f12b9b509 | 22 | if ( switches== 1) { |
thetstone | 0:be1f12b9b509 | 23 | servo_2 = .6; |
thetstone | 0:be1f12b9b509 | 24 |