Ilya Khorosh
/
Lab3_Robot
Robot code
main.cpp
- Committer:
- ikhorosh
- Date:
- 2011-10-13
- Revision:
- 0:c8a510f695d2
File content as of revision 0:c8a510f695d2:
#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; } } }