Lidar_LiteGarmin
Dependencies: mbed LidarLitev2
Revision 0:ee825cd264b6, committed 2018-03-26
- Comitter:
- agaikwad
- Date:
- Mon Mar 26 23:51:52 2018 +0000
- Commit message:
- Get Lidar Data through UART
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LidarLitev2.lib Mon Mar 26 23:51:52 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/sventura3/code/LidarLitev2/#b0deebd36eb3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Mar 26 23:51:52 2018 +0000
@@ -0,0 +1,79 @@
+#include "LidarLitev2.h"
+
+
+LidarLitev2 Lidar(PTE25, PTE24);
+Serial pc(USBTX,USBRX);
+Serial device(PTC17, NC);
+
+Timer dt;
+
+int main()
+{
+
+ pc.baud(115200);
+ device.baud(115200);
+ Lidar.configure();
+ dt.start();
+
+ while(1){
+ pc.printf( "distance =%d cm\t",Lidar.distance());
+ //device.printf( "%d" ,Lidar.distance());
+ //int temp=Lidar.distance();
+ wait_ms(500);
+ //pc.printf("%d\n",temp);
+
+ dt.reset();
+ if(Lidar.distance()>1 and Lidar.distance()<=30)
+ {
+ device.printf("1");
+ pc.printf("case: 1\r\n");
+ }
+
+ else if(Lidar.distance()>30 and Lidar.distance()<=60)
+ {
+ device.printf("2");
+ pc.printf("case: 2\r\n");
+ }
+ else if(Lidar.distance()>60 and Lidar.distance()<=90)
+ {
+ device.printf("3");
+ pc.printf("case: 3\r\n");
+ }
+ else if(Lidar.distance()>90 and Lidar.distance()<=120)
+ {
+ device.printf("4");
+ pc.printf("case: 4\r\n");
+ }
+ else if(Lidar.distance()>120 and Lidar.distance()<=150)
+ {
+ device.printf("5");
+ pc.printf("case: 5\r\n");
+ }
+ else if(Lidar.distance()>150 and Lidar.distance()<=180)
+ {
+ device.printf("6");
+ pc.printf("case: 6\r\n");
+ }
+ else if(Lidar.distance()>180 and Lidar.distance()<=210)
+ {
+ device.printf("7");
+ pc.printf("case: 7\r\n");
+ }
+ else if(Lidar.distance()>210 and Lidar.distance()<=240)
+ {
+ device.printf("8");
+ pc.printf("case: 8\r\n");
+ }
+ else if(Lidar.distance()>240 and Lidar.distance()<=800)
+ {
+ device.printf("9");
+ pc.printf("case: 9\r\n");
+ }
+ else
+ {
+ device.printf("0");
+ pc.printf("case: 0\r\n");
+ }
+
+}
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Mar 26 23:51:52 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/aa5281ff4a02 \ No newline at end of file