test
Dependencies: S11059 VL6180X m3pi mbed
Fork of tc_agent by
Diff: main.cpp
- Revision:
- 1:6340d62d759f
- Parent:
- 0:2508f38e90fe
- Child:
- 2:3ebca956fd36
diff -r 2508f38e90fe -r 6340d62d759f main.cpp --- a/main.cpp Mon Oct 19 16:47:41 2015 +0000 +++ b/main.cpp Tue Jul 19 00:53:45 2016 +0000 @@ -1,14 +1,42 @@ #include "VL6180.h" #include "mbed.h" +#include "m3pi.h" +#include "S11059-SoftI2C.h" -VL6180 rf(p9, p10); //I2C sda and scl +VL6180 rf(p28, p27); //I2C sda and scl Serial pc(USBTX, USBRX); //USB serial +S11059 col(p19,p20); +m3pi m3pi; +Timer t; int main() { + m3pi.cls(); + m3pi.locate(0,0); + m3pi.printf("Sensor"); + m3pi.locate(0,1); + m3pi.printf("Check"); + wait(1); float reading; + float time[2]; + int bl=0; + char buf[255]; + + m3pi.cls(); while(1) { + m3pi.cls(); + t.start(); + time[0] = t.read(); reading = rf; - pc.printf("Read %4.1f cm\n", reading); - wait(0.5); + t.stop(); + time[1] = t.read(); + + + int len = 0; + //m3pi.locate(0,0); + //len = sprintf(buf,"%f",reading); + m3pi.locate(0,1); + m3pi.printf("%f",time[1]-time[0]); + pc.printf("Read %4.1f cm\n\r", reading); + m3pi.print(buf,len); } } \ No newline at end of file