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.
main.cpp
00001 /** 00002 * XBee Example Test 00003 * A test application that demonstrates the ability 00004 * of transmitting serial data via an XBee module with 00005 * an mbed microprocesor. 00006 * By: Vlad Cazan 00007 * Date: Tuesday, September 29th 2009 00008 */ 00009 00010 #include "mbed.h" 00011 00012 Serial xbee1(p9, p10); //Creates a variable for serial comunication through pin 9 and 10 00013 00014 DigitalOut rst1(p11); //Digital reset for the XBee, 200ns for reset 00015 00016 DigitalOut myled(LED3);//Create variable for Led 3 on the mbed 00017 DigitalOut myled2(LED4);//Create variable for Led 4 on the mbed 00018 00019 Serial pc(USBTX, USBRX);//Opens up serial communication through the USB port via the computer 00020 00021 int main() { 00022 rst1 = 0; //Set reset pin to 0 00023 myled = 0;//Set LED3 to 0 00024 myled2= 0;//Set LED4 to 0 00025 wait_ms(1);//Wait at least one millisecond 00026 rst1 = 1;//Set reset pin to 1 00027 wait_ms(1);//Wait another millisecond 00028 00029 while (1) {//Neverending Loop 00030 if (pc.readable()) {//Checking for serial comminication 00031 myled = 0; //Turn Led 3 Off 00032 xbee1.putc(pc.getc()); //XBee write whatever the PC is sending 00033 myled = 1; //Turn Led 3 on for succcessfull communication 00034 } 00035 } 00036 }
Generated on Fri Jul 15 2022 21:22:11 by
1.7.2