Emiel Estiévenart / Mbed 2 deprecated ProjectTransmitter01

Dependencies:   mbed

Revision:
0:dd5518967e8a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Feb 20 11:47:19 2016 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+
+Serial xbee(p9,p10);
+DigitalIn up(p15);              //pin 15 is connected to the joystick on the application board
+DigitalIn down(p12);            //pin 12 is connected to the joystick on the application board
+DigitalOut LED(LED1);           //test led to check if the joystick is working
+
+int main() {
+    xbee.baud(57600);
+    while(1) {
+        wait_ms(100);           //to reduce buffer fill. Can be increased at the expense of less sensitive buttons
+        if(up){                 //check the direction of the joystick
+            xbee.putc('u');     //send a character
+            LED = 1;
+            }
+        if(down){
+            xbee.putc('d');
+            }
+        
+    }
+}