Tuk workshop
Dependencies: mbed RC_Servo VMA306 PID CNY70 CMPS03 GP2A Pixy
Diff: main.cpp
- Revision:
- 17:961a91037658
- Parent:
- 16:c0b098c83233
- Child:
- 18:96264a9ddaf6
diff -r c0b098c83233 -r 961a91037658 main.cpp --- a/main.cpp Thu Oct 31 14:46:56 2019 +0000 +++ b/main.cpp Thu Oct 31 16:13:21 2019 +0000 @@ -7,6 +7,7 @@ #include "PID.h" #include "motor_state.h" + #define PI 3.1415926535898 Serial pc (PA_2, PA_3, 115200); @@ -15,8 +16,8 @@ CMPS03 boussole (PC_4); -CNY70 ligneD (PC_3); -CNY70 ligneG (PC_2); +CNY70 right_center (PC_3); +CNY70 left_center (PC_2); CNY70 exterior (PA_7); VMA306 ultraSon (PB_15, PA_6, PB_14, PC_7, PB_13, PB_2); @@ -82,7 +83,12 @@ if (ultraSon.readUSB() <= 20) { current_state = SAFEMODE; } - if (x<=-2000) current_state = STUPID1; + if (left_center.whatAmIOn()== 0) + { + led1==1; + motor.resetPosition(); + } + if (x<=-1300) current_state = STUPID1; break; case BACKWARD :