It is a test program of wallbot library.

Dependencies:   mbed wallbot

main.cpp

Committer:
jksoft
Date:
2013-07-28
Revision:
0:ce9fda861f9e

File content as of revision 0:ce9fda861f9e:

#include "mbed.h"
#include "wallbot.h"

wallbot wb;

BusOut leds(LED1,LED2,LED3,LED4);

int main() {

    wait(0.5);
    
    // Motor test.
    wb.forward(0.5);
    wait (2.0);
    wb.left(0.5);
    wait (2.0);
    wb.backward(0.5);
    wait (2.0);
    wb.right(0.5);
    wait (2.0);
    
    wb.stop();

    // Sensor & Switch test.
    while(1)
    {
        int bit;
        wb.GetLinePosition(&bit);
        printf("LeftSw:%d  RightSw:%d FloorSensor:%X\r\n",wb.GetLeftSw(),wb.GetRightSw(),bit);
        leds = bit;
        wait(0.1);
    }
 }