code
Dependencies: ContinuousServo Final Project ES202 KANG TRUONG ADAMS TCS3472_I2C Tach
PROJECT.cpp@2:9ab67bed1a34, 2018-04-19 (annotated)
- Committer:
- kingkang2
- Date:
- Thu Apr 19 14:31:10 2018 +0000
- Revision:
- 2:9ab67bed1a34
- Parent:
- 1:8a2bdbd69fba
- Child:
- 3:8d12cc699e4c
i luh you
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kingkang2 | 0:b33656ee16a7 | 1 | #include "mbed.h" |
kingkang2 | 0:b33656ee16a7 | 2 | #include "ContinuousServo.h" |
kingkang2 | 0:b33656ee16a7 | 3 | #include "Tach.h" |
kingkang2 | 0:b33656ee16a7 | 4 | #include "TCS3472_I2C.h" |
kingkang2 | 0:b33656ee16a7 | 5 | |
kingkang2 | 0:b33656ee16a7 | 6 | Serial pc(USBTX,USBRX); |
kingkang2 | 0:b33656ee16a7 | 7 | // color sensor |
kingkang2 | 0:b33656ee16a7 | 8 | TCS3472_I2C rgb_sensor( p9, p10 ); // Establish RGB sensor object |
kingkang2 | 0:b33656ee16a7 | 9 | // Hall effect sensor |
kingkang2 | 0:b33656ee16a7 | 10 | DigitalIn hall(p22); |
kingkang2 | 0:b33656ee16a7 | 11 | // sonar sensor |
kingkang2 | 0:b33656ee16a7 | 12 | AnalogIn sonar(p20); // range sensor 9.8 mV/inch |
kingkang2 | 0:b33656ee16a7 | 13 | //servos |
kingkang2 | 0:b33656ee16a7 | 14 | ContinuousServo left(p23); |
kingkang2 | 0:b33656ee16a7 | 15 | ContinuousServo right(p26); |
kingkang2 | 0:b33656ee16a7 | 16 | //encoders |
kingkang2 | 0:b33656ee16a7 | 17 | Tach tLeft(p17,64); |
kingkang2 | 1:8a2bdbd69fba | 18 | Tach tRight(p13,64); |
kingkang2 | 1:8a2bdbd69fba | 19 | |
kingkang2 | 1:8a2bdbd69fba | 20 | //drive straight |
kingkang2 | 1:8a2bdbd69fba | 21 | |
kingkang2 | 2:9ab67bed1a34 | 22 | w = 0; |
kingkang2 | 2:9ab67bed1a34 | 23 | v = 0.5; |