hi

Dependencies:   m3pimaze mbed

hiworld.cpp

Committer:
parikhkathan
Date:
2018-07-17
Revision:
0:cce248cfb763
Child:
1:7ca26e605828

File content as of revision 0:cce248cfb763:

/************************************************************
Program: Hello World for the Pololu Robot
File:    HiWorld.cpp
Author:  Your Name
Date:    Today's date
Description: A simple robot program.
************************************************************/

// includes needed for all mbed programs
#include "mbed.h"
#include "m3pimaze.h"

// variables for the robot and a blue led on the robot
m3pi robot(p23, p9, p10);
DigitalOut blueLed(LED1);

int main()
{
    float voltage; // define a variable
    robot.cls(); // clear the robot lcd display
    robot.locate(0, 0); // position the lcd cursor (column 0, row 0)
    robot.printf("HI WORLD"); // display the message
    
    while(1) // this makes the program repeat the following statements forever
    { // repeating starts here
        voltage = robot.battery(); // get the robot battery voltage
        robot.locate(0, 1); // position the lcd cursor (column 0, row 1)
        robot.printf("VB=%.3f", voltage); // display the battery voltage
        blueLed = 1; // turn on blue led 1
        wait(0.5); // wait for half a second
        blueLed = 0; // turn off blue led 1
        wait(0.5); // wait for half a second
    } // loop round and repeat the above statements
}