Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: C12832_lcd mbed xbee_lib
Revision 0:1b9f7485eb2c, committed 2015-02-15
- Comitter:
- dannellyz
- Date:
- Sun Feb 15 06:26:55 2015 +0000
- Commit message:
- Bus comms (external protocol) with xbee
Changed in this revision
diff -r 000000000000 -r 1b9f7485eb2c C12832_lcd.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832_lcd.lib Sun Feb 15 06:26:55 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/dreschpe/code/C12832_lcd/#8f86576007d6
diff -r 000000000000 -r 1b9f7485eb2c main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun Feb 15 06:26:55 2015 +0000
@@ -0,0 +1,53 @@
+#include "mbed.h"
+#include "xbee.h" // Include for xbee code
+#include "C12832_lcd.h" // Include for LCD code
+#include <stdio.h> //Include for sprintf
+
+xbee xbee1(p9,p10,p30); //Initalise xbee_lib varName(rx,tx,reset)
+DigitalOut rst1(p30);
+Serial pc(USBTX, USBRX); //Initalise PC serial comms
+C12832_LCD lcd; //Initialize LCD Screen
+
+//Initialize the joystick on the appBoard as a Bus
+BusIn joy(p15,p12,p13,p16);
+//Set the button as a Digital In
+DigitalIn fire(p14);
+
+int main()
+{
+ // reset the xbees (at least 200ns)
+ rst1 = 0;
+ wait_ms(1);
+ rst1 = 1;
+ wait_ms(1);
+ //Setup LCD screen
+ lcd.cls();
+ lcd.locate(0,1);
+
+ char sendData[1]; //Buffer to send value of bus
+
+ while(1) {
+
+ //Digital pin to check for button press
+ int yes = 0;
+
+ //If pressed send 9
+ if(fire) {
+ yes = 1;
+ sprintf (sendData, "%d", 9);
+ }
+ //Else send value of the Bus
+ else{
+ sprintf (sendData, "%d", joy.read());
+ }
+
+ xbee1.SendData(sendData); //Send data to XBee
+
+ //Local of value sent
+ lcd.printf("Value = %s \n", sendData);
+ wait(0.1);
+
+
+
+ }
+}
diff -r 000000000000 -r 1b9f7485eb2c mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Feb 15 06:26:55 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file
diff -r 000000000000 -r 1b9f7485eb2c xbee_lib.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xbee_lib.lib Sun Feb 15 06:26:55 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/tristanjph/code/xbee_lib/#ede20c047d8b