sample program for lpc1114 with the Library TRP105F_Spline. Use this with the program DistanceSensor_BaseUnit which is for mbed lpc1768
Dependencies: TRP105F_Spline mbed
Revision 0:01b4a04a6167, committed 2016-06-08
- Comitter:
- aktk
- Date:
- Wed Jun 08 14:11:08 2016 +0000
- Commit message:
- sample program for lpc1114. use with the program DistanceSensor_BaseUnit which for mbed lpc1768.
Changed in this revision
diff -r 000000000000 -r 01b4a04a6167 TRP105F_Spline.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TRP105F_Spline.lib Wed Jun 08 14:11:08 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/aktk/code/TRP105F_Spline/#f6ec7796dafd
diff -r 000000000000 -r 01b4a04a6167 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jun 08 14:11:08 2016 +0000 @@ -0,0 +1,56 @@ +#include "mbed.h" +#include "CODE_SELECTIVE.h" +#include "TRP105F_Spline.h" + +DigitalOut myled(LED1); +DigitalIn unisig(dp13); +TRP105FS sensor(5, dp4); +Serial com_lpc1768(dp16, dp15); + +int main() +{ + char c; + unsigned short x; + + while(1) { + c = com_lpc1768.getc(); + + if(c == 0) { + c = com_lpc1768.getc(); + switch(c) { + case 'c': + for(int i = 0; i < 5; i++) { + while( unisig){;} + while(!unisig){;} + sensor.setSample(i * 255 / 4, sensor.getVoltage()); + com_lpc1768.putc(i + 1); + } + sensor.calibrate(); + sensor.saveSetting_intoSerial(&com_lpc1768); + break; + case 'l': + sensor.loadSetting_fromSerial(&com_lpc1768); + break; + } + + while(1) { + myled = 1; + c = com_lpc1768.getc(); + if(c == 0x11) { + c = com_lpc1768.getc(); + for(int i = 0; i < c; i++) + com_lpc1768.putc(com_lpc1768.getc()); + }// + + else if (c == 0x12) { + myled = 0; + x = sensor.getDistance(); + com_lpc1768.putc((x>>8)&0xFF); + com_lpc1768.putc((x )&0xFF); + } + + } + + } + } +}
diff -r 000000000000 -r 01b4a04a6167 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jun 08 14:11:08 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34 \ No newline at end of file