Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of All-15 by
Diff: main.cpp
- Revision:
- 15:dbb2ef352057
- Parent:
- 14:7560cbb335f1
- Child:
- 16:b952b10f2f6e
--- a/main.cpp Tue Jul 07 22:34:07 2015 +0000 +++ b/main.cpp Tue Jul 07 22:37:54 2015 +0000 @@ -17,7 +17,8 @@ DigitalOut enable(P1_2); DigitalIn SensorL(P1_12); DigitalIn SensorR(P1_13); -int data; +float slow = 0.25; +float fast = 0.50; int out_helper[8]; int main() { @@ -66,7 +67,7 @@ { enable = 1; online = 1; - if((myline==0&&linecenter==0)||(myline==15&&linecenter==15)) + if((myline==0&&linecenter==0)||(myline==15&&linecenter==1)) { active = false; MotorL_EN = 0; @@ -90,11 +91,11 @@ MotorR_FORWARD = 1; if((myline&0x04)>0) { - MotorR_EN=0.25; + MotorR_EN=slow; output=output&(~0x40); } else - MotorR_EN=0.5; + MotorR_EN=fast; } if((myline&0x01)>0) @@ -108,11 +109,11 @@ MotorL_FORWARD = 1; if((myline&0x02)>0) { - MotorL_EN=0.25; + MotorL_EN=slow; output=output&(~0x20); } else - MotorL_EN=0.5; + MotorL_EN=fast; } myled=myline; i2c.start(); @@ -141,7 +142,7 @@ enable = 1; online = 1; wait(0.5); - if(myline==15&&linecenter==15) + if(myline==15&&linecenter==1) myrgb=0; else if((myline>=1)||(linecenter==1))