background image

Arduino

Arduino

Warning for Users NOT Using the Arduino Serial Monitor!

 If you are using Digi's X-CTU or a

serial terminal

 to configure or connect to an XBee by using a RedBoard/Arduino Uno as a serial

passthrough, you may need to add a jumper wire between the RST and 5V pin to prevent the
Arduino from resetting.

Basically when the XCTU or serial terminal opens a COM port to the Arduino, computer resets the
microcontroller while looking for the XBee. Therefore, it can’t communicate with the XBee because
the Arduino is rebooting.

Hardware Serial Passthrough

This example is for those trying to use the hardware UART on an ATmega32U4-based Arduino.
Copy and upload the sketch below. You can also download it 

here

.

language:c
/*****************************************************************
Leonardo_XBee_Serial_Passthrough.ino

Set up a serial port to pass data between an XBee Shield
and the serial monitor.

Hardware Hookup:
  The XBee Shield makes all of the connections you'll need
  between Arduino and XBee. If you have the shield make
  sure the SWITCH IS IN THE "UART" POSITION. That will connect
  the XBee's DOUT and DIN pins to Arduino pins 0 and 1.
*****************************************************************/

// Leonardo Serial  is the USB port
// Leonardo Serial1 is pins 0 and 1

Page 14 of 24

Содержание Shield

Страница 1: ...municate in transparency mode However this can apply to the XBee Series 3 module as long as you configure the firmware to the legacy 802 15 4 protocol For more information check out the Exploring XBee...

Страница 2: ...SparkFun XBee Shield WRL 12847 16 95 26 Favorited Favorite 25 Wish List Page 2 of 24...

Страница 3: ...SparkFun XBee 3 Wireless Kit KIT 15936 78 95 2 Favorited Favorite 13 Wish List Page 3 of 24...

Страница 4: ...h we explain in a separate tutorial Covered In This Tutorial The goal of this tutorial is to set up wireless XBee communication between a computer and an Arduino XBee Shield combo Then using a termina...

Страница 5: ...her with atrace antenna wire antenna or u fl connector For more help picking an XBee check out ourXBee Buying Guide Heads up While this tutorial was written for XBee Series 1 you can still follow alon...

Страница 6: ...lain how to configure XBee networks and addresses In addition to that tutorial we also recommend checking these guides out Serial Communication Serial communication is critical to controlling and mana...

Страница 7: ...s What they are and how to assemble them Favorited Favorite 5 Hardware Overview Here s a quick overview of the most components of the XBee Shield Below we ll go more in depth on the most important com...

Страница 8: ...to any device attached to the Arduino s hardware UART So to avoid any problems that might arise from connecting the XBee to the Arduino s hardware UART we usually take advantage of the Software Serial...

Страница 9: ...xplaining the operation of each LED LED Label LED Color XBee Pin Connection Default Operation Notes PWR Red 3 3V Indicates power is present DIO5 Green Associate DIO5 Associated indicator blinks when t...

Страница 10: ...re is some white silkscreen on the Shield PCB to help orient your XBee as you re plugging it in Make sure to match up the XBee s two diagonal edges with the two diagonal lines on the PCB With everythi...

Страница 11: ...is example assumes you haveXCTU installed and two compatibly configured XBees one connected to your computer via a USB Explorer or Dongle or Serial Explorer and another plugged into the Shield Arduino...

Страница 12: ...reSerial XBee 2 3 RX TX For Atmega2560 ATmega32U4 etc XBee s DOUT TX is connected to pin 10 Arduino s Software RX XBee s DIN RX is connected to pin 11 Arduino s Software TX SoftwareSerial XBee 10 11 R...

Страница 13: ...ge for the Software Serial library Arduino Software Serial Library Pin Definitions To use re define the software serial pins on an Arduino Mega 2560 or Arduino Leonardo you would just need to comment...

Страница 14: ...cate with the XBee because the Arduino is rebooting Hardware Serial Passthrough This example is for those trying to use the hardware UART on an ATmega32U4 based Arduino Copy and upload the sketch belo...

Страница 15: ...ad XBee UART1 pins 0 and 1 if Serial1 available XBee UART1 pins 0 and 1 If data comes in from XBee send it out to serial monitor Serial write Serial1 read Serial port Note If you are using an Arduino...

Страница 16: ...xploring XBee tutorial Example Remote Control Arduino Setting up a chat system is fun but where XBees and the XBee Shield really shine is in passing data to and from an Arduino so you can remotely con...

Страница 17: ...fics IDE Arduino 1 0 5 Hardware Platform SparkFun RedBoard XBee Shield XBee Series 1 1mW w whip antenna XBee USB Explorer connected to computer with another XBee Series 1 1mW connected to that This co...

Страница 18: ...le XBee available 2 Wait for pin and value to become available char pin XBee read char hl ASCIItoHL XBee read Print a message to let the control know of our intentions XBee print Setting pin XBee prin...

Страница 19: ...enter Then send a digital pin to be read The Arduino will print the digital reading of the pin to XBee void readDPin while XBee available 1 Wait for pin to be available char pin XBee read Read in the...

Страница 20: ...prints that print a usage menu over to the other XBee void printMenu Everything is F d which stores the strings in flash That ll free up SRAM for more importanat stuff XBee println XBee println F Ardu...

Страница 21: ...he Arduino sketch first starts up it will print a helpful usage menu After that s printed follow the directions to send commands to your Arduino To control pins 10 11 12 and 13 send the hexadecimal eq...

Страница 22: ...ing to a single computer The power of XBees comes from their simplicity they make your projects wireless by simply serial printing Resources and Going Further That should be enough to get you started...

Страница 23: ...p further by controlling it with an XBee Simon Splosion Wireless This is a tutorial demonstrating one of many techniques to hack the Simon Says We will highlight the technique to take your Simon Says...

Страница 24: ...Page 24 of 24...

Отзывы: