James Nagendran
/
4180_final_transmitter
Joystick for SLVM
main.cpp
- Committer:
- jnagendran3
- Date:
- 2014-12-09
- Revision:
- 0:636b2ff1fa0b
File content as of revision 0:636b2ff1fa0b:
#include "mbed.h" #include "xbee.h" //Sender code AnalogIn JS1x(p19); AnalogIn JS2x(p20); xbee xbee1(p9,p10,p11); //Initalise xbee_lib Serial Sender(p9,p10); int main() { char x1, x2, x3, rr=0x00; while(1) { if(JS1x<.25) x1= 0x0C; else if(JS1x>.75) x1= 0x03; else x1= 0x00; if(JS2x>.75) x2= 0x0C; else if(JS2x<.25) x2= 0x03; else x2= 0x00; x3=(x1<<4)|x2; if (x3!=rr)Sender.putc(x3); //just says to only send new commands, can remove if you want rr=x3; } }