Basic Xbee transmitter with application board. Use joystick to send up or down.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 Serial xbee(p9,p10);
00004 DigitalIn up(p15);              //pin 15 is connected to the joystick on the application board
00005 DigitalIn down(p12);            //pin 12 is connected to the joystick on the application board
00006 DigitalOut LED(LED1);           //test led to check if the joystick is working
00007 
00008 int main() {
00009     xbee.baud(57600);
00010     while(1) {
00011         wait_ms(100);           //to reduce buffer fill. Can be increased at the expense of less sensitive buttons
00012         if(up){                 //check the direction of the joystick
00013             xbee.putc('u');     //send a character
00014             LED = 1;
00015             }
00016         if(down){
00017             xbee.putc('d');
00018             }
00019         
00020     }
00021 }