Ilya Khorosh
/
Lab3_Robot
Robot code
Diff: main.cpp
- Revision:
- 0:c8a510f695d2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Oct 13 03:06:59 2011 +0000 @@ -0,0 +1,34 @@ +#include "mbed.h" + +Serial xbee1(p9, p10); +DigitalOut rst1(p11); + +DigitalOut rev(p22); +DigitalOut fwd(p20); +DigitalOut Led1(LED1); +DigitalOut Led2(LED2); + +PwmOut pwmout(p21); + +Serial pc(USBTX, USBRX); + +int main() { + + rst1 = 0; //Set reset pin to 0 + wait(.5); + rst1 = 1; //Set reset pin to 1 + int X = 0; + wait(.5); + pc.printf("starting rec"); + rev = 1; + fwd = 0; + char b = 'c'; + while(1) { + if(xbee1.readable()) { + char X = xbee1.getc(); //XBee read + wait(.25); + pc.printf("b = %f", X/100.0); + pwmout = X/100.0; + } + } +}