Software for mapping with the Lidar lite v2, stepper motor, and stepper motor driver
Dependencies: DRV88255 LidarLitev2 MODSERIAL mbed
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
diff -r 000000000000 -r 8327d88550ab DRV88255.lib --- /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
diff -r 000000000000 -r 8327d88550ab LidarLitev2.lib --- /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
diff -r 000000000000 -r 8327d88550ab MODSERIAL.lib --- /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
diff -r 000000000000 -r 8327d88550ab main.cpp --- /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
diff -r 000000000000 -r 8327d88550ab mbed.bld --- /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