SChuleEE 1
/
mbed_linie
wr
Diff: main.cpp
- Revision:
- 0:a8e2201d9c4d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Jun 14 11:15:13 2016 +0000 @@ -0,0 +1,44 @@ +#include "mbed.h" +#include "Serial_HL.h" +#include "Bertl14.h" +#include "BertlObjects.h" + +// main=2^0 LS ENC 2^2 +BusOut boardPow(p30, P1_6, P1_7); +AnalogInHL ls1(p18), ls2(p16), ls3(p20), ls4(p19),ls5(p17); + + +int main(void) +{ + boardPow=3; + + pex.WaitUntilFrontButtonPressed(); + mL.SetPow(0.3); mR.SetPow(0.3); + + while(1) + { + if(ls1.Read()>600&&ls5.Read()<600) + { + mL.SetPow(-0.3); mR.SetPow(0.3); + } + if(ls5.Read()>600&&ls1.Read()<600) + { + mL.SetPow(0.3); mR.SetPow(-0.3); + } + if(ls5.Read()<600&&ls1.Read()<600&&ls3.Read()>600) + { + mL.SetPow(0.3); mR.SetPow(0.3); + } + if(ls5.Read()<400&&ls1.Read()<400&&ls3.Read()<400&&ls2.Read()<400&&ls4.Read()<500) + { + wait(0.07); + if(ls5.Read()<400&&ls1.Read()<400&&ls3.Read()<400&&ls2.Read()<400&&ls4.Read()<500) + { + mL.SetPow(0); mR.SetPow(0); + wait(2); + mL.SetPow(-0.3); mR.SetPow(0.3); + wait(0.7); + } + } + } +} \ No newline at end of file