Basic HelloWorld on how to use LidarLitev2

Dependencies:   LidarLitev2 mbed

Committer:
sventura3
Date:
Thu Oct 22 21:39:34 2015 +0000
Revision:
1:b6f905ba0c2a
Parent:
Distance.cpp@0:1c42ae9ef9a2
Changed the main file to main -_-

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sventura3 0:1c42ae9ef9a2 1 #include "LidarLitev2.h"
sventura3 0:1c42ae9ef9a2 2
sventura3 0:1c42ae9ef9a2 3
sventura3 0:1c42ae9ef9a2 4 LidarLitev2 Lidar(p28, p27);
sventura3 0:1c42ae9ef9a2 5 Serial pc(USBTX,USBRX);
sventura3 0:1c42ae9ef9a2 6
sventura3 0:1c42ae9ef9a2 7
sventura3 0:1c42ae9ef9a2 8 Timer dt;
sventura3 0:1c42ae9ef9a2 9 int main()
sventura3 0:1c42ae9ef9a2 10 {
sventura3 0:1c42ae9ef9a2 11
sventura3 0:1c42ae9ef9a2 12 pc.baud(115200);
sventura3 0:1c42ae9ef9a2 13 Lidar.configure();
sventura3 0:1c42ae9ef9a2 14 dt.start();
sventura3 0:1c42ae9ef9a2 15 while(1){
sventura3 0:1c42ae9ef9a2 16 pc.printf("distance = %d cm frequency = %.2f Hz\n", Lidar.distance(), 1/dt.read());
sventura3 0:1c42ae9ef9a2 17 dt.reset();
sventura3 0:1c42ae9ef9a2 18 }
sventura3 0:1c42ae9ef9a2 19 }