Six crescent shaped legs

Dependencies:   mbed

main.cpp

Committer:
sim642
Date:
2016-03-29
Revision:
2:cf0147952fb9
Parent:
1:8b0322a353f4
Child:
3:2235787e78c4

File content as of revision 2:cf0147952fb9:

#include "mbed.h"
#include "Motor.hpp"
#include "Encoder.hpp"

InterruptIn bt(USER_BUTTON);
Serial pc(USBTX, USBRX);

Motor m(PB_0, PC_0, PC_1);
Encoder e(PA_0, PA_1);

void rise()
{
    pc.printf("rise\n");
    m.drive(0.1f);
}

void fall()
{
    pc.printf("fall\n");
    m.drive(-0.1f);
}

int main()
{
    bt.rise(rise);
    bt.fall(fall);
    while(1)
    {
        pc.printf("%d\n", e.getCount());
        wait(0.5);
    }
}