2D scan
Dependencies: DRV88255 LidarLitev2 MODSERIAL mbed
Fork of Lidar_2D_Mapping by
Revision 0:8327d88550ab, committed 2015-12-11
- Comitter:
- sventura3
- Date:
- Fri Dec 11 15:51:05 2015 +0000
- Commit message:
- finished the mapping;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DRV88255.lib Fri Dec 11 15:51:05 2015 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/sventura3/code/DRV88255/#c8f423bfe891
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LidarLitev2.lib Fri Dec 11 15:51:05 2015 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/sventura3/code/LidarLitev2/#b0deebd36eb3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MODSERIAL.lib Fri Dec 11 15:51:05 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/AjK/code/MODSERIAL/#ae0408ebdd68
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Dec 11 15:51:05 2015 +0000
@@ -0,0 +1,46 @@
+#include "LidarLitev2.h"
+#include "DRV8825.h"
+#include "MODSERIAL.h"
+#include "math.h"
+
+#define PI 3.14159265359
+
+Serial pc(USBTX, USBRX);
+
+DRV8825 stpr_mtr(p21, p22, p23, p24, p25, p26);
+DigitalIn pinMode(p19);
+
+LidarLitev2 Lidar(p28, p27);
+
+
+int main()
+{
+ stpr_mtr.direction = 1;
+ pc.baud(9600);
+ Lidar.configure();
+ //Lidar.beginContinuous();
+ float degree = 0, x, y;
+ int distance;
+ char e;
+ while(1){
+ if(pc.readable()) {
+ e = pc.getc();
+ }
+ while (e == 'e'){
+ //if(!pinMode) { //Check if the lidar is pulling low
+ distance = Lidar.distance();
+ x = distance*cos(degree*(PI/180));
+ y = distance*sin(degree*(PI/180));
+ stpr_mtr.settings(1, 0, 400);
+ degree += .45;
+ if(degree >= 360) degree = 0;
+ //pc.printf("%4d,%4.0f\n", distance, degree);
+ pc.printf("%4.0f,%4.0f\n", x, y);
+ //}
+ if(pc.readable()) {
+ e = pc.getc();
+ }
+ if (e == 's') break;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Dec 11 15:51:05 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/165afa46840b \ No newline at end of file
