Test program for the LidarLitePwm library

Dependencies:   LidarLitePwm mbed

Committer:
joe4465
Date:
Wed Mar 18 09:17:35 2015 +0000
Revision:
1:98f5bd664f94
Parent:
0:cea49dbec4b6
V1.1 Internal timer

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joe4465 0:cea49dbec4b6 1 #include "mbed.h"
joe4465 0:cea49dbec4b6 2 #include "LidarLitePwm.h"
joe4465 0:cea49dbec4b6 3
joe4465 0:cea49dbec4b6 4 Serial _pc(USBTX, USBRX);
joe4465 0:cea49dbec4b6 5
joe4465 1:98f5bd664f94 6 LidarLitePwm _lidar(p12);
joe4465 0:cea49dbec4b6 7
joe4465 0:cea49dbec4b6 8 int main()
joe4465 0:cea49dbec4b6 9 {
joe4465 0:cea49dbec4b6 10 _pc.baud(115200);
joe4465 0:cea49dbec4b6 11
joe4465 0:cea49dbec4b6 12 printf("Started\r\n");
joe4465 0:cea49dbec4b6 13
joe4465 0:cea49dbec4b6 14 while(1)
joe4465 0:cea49dbec4b6 15 {
joe4465 0:cea49dbec4b6 16 int lidarAltitude = _lidar.read();
joe4465 0:cea49dbec4b6 17 printf("altitude: %d cm\r\n", lidarAltitude);
joe4465 0:cea49dbec4b6 18
joe4465 0:cea49dbec4b6 19 wait_ms(20);
joe4465 0:cea49dbec4b6 20 }
joe4465 0:cea49dbec4b6 21 }