Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed LidarLitev2
Diff: main.cpp
- Revision:
- 1:43e6d9eece03
- Parent:
- 0:ee825cd264b6
--- a/main.cpp Mon Mar 26 23:51:52 2018 +0000
+++ b/main.cpp Thu Mar 28 03:08:03 2019 +0000
@@ -16,63 +16,29 @@
dt.start();
while(1){
- pc.printf( "distance =%d cm\t",Lidar.distance());
+ pc.printf( "distance (control motor speed)=%d cm\t",Lidar.distance());
//device.printf( "%d" ,Lidar.distance());
//int temp=Lidar.distance();
- wait_ms(500);
+ wait_ms(100);
//pc.printf("%d\n",temp);
dt.reset();
- if(Lidar.distance()>1 and Lidar.distance()<=30)
+ if(Lidar.distance()>20 and Lidar.distance()<=90)
{
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 if (Lidar.distance()>90 and Lidar.distance()<=700)
+ {
+ device.printf("2");
+ pc.printf("case: 2\r\n");
+ }
+
else
{
device.printf("0");
- pc.printf("case: 0\r\n");
+ pc.printf("case: 0 and Airbag Deployed\r\n");
}
}