The Dream Team
/
first_test
Pop lock n drop it
Diff: linepos.cpp
- Revision:
- 7:d0c19729e7fd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/linepos.cpp Thu May 22 12:51:22 2014 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "m3pi_ng.h" +#include "DigitalIn.h" + + +m3pi hue; + + + +float myLine(void) +{ + int sensors[5]; + hue.calibrated_sensor(sensors); + float leftSen, rightSen, midSen; + leftSen = sensors[1] / 1000; + rightSen = sensors[3] / 1000; + midSen = sensors[2] / 1000; + return rightSen - leftSen; +} + +int linepos() +{ + while(1) + { + hue.printf("%f", myLine()); + } + +} \ No newline at end of file