yoshikawa kyoto
Dependencies: S11059-SoftI2C VL6180 m3pi mbed
Fork of VL6180_Hello_World by
main.cpp
- Committer:
- tennisbaca
- Date:
- 2016-07-19
- Revision:
- 1:6340d62d759f
- Parent:
- 0:2508f38e90fe
File content as of revision 1:6340d62d759f:
#include "VL6180.h" #include "mbed.h" #include "m3pi.h" #include "S11059-SoftI2C.h" 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; 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); } }