Book Image

Intel Galileo Essentials

Book Image

Intel Galileo Essentials

Overview of this book

Table of Contents (15 chapters)
Intel Galileo Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Enabling an XBee Interface in the IDE


Let's first set up the IDE for the XBee that will be connected to the Galileo. Once you have connected the shield to the Galileo, simply connect the Galileo with the USB cable to your host computers. Bring up the IDE and then type in the following code into the sketch window:

Here is an explanation of this set of code:

  • This set of code initializes the serial port on the Galileo, so you can receive via the serial interface:

    TTYUARTClass* gSerialStdPtr = &Serial; // Galileo, /dev/ttyGSO, Tx pin
    TTYUARTClass* gSerialTwoPtr = &Serial1; // Galileo, /dev/ttySO, Rx pin
    bool gGalileo = true;
    bool qData;
    int led = 13;
  • This set of code starts the send and receive process, you'll only use the receive process for this application:

    qData = false; // Initialize on reset
    gSerialStdPtr->begin(9600); // Receiver
    gSerialTwoPtr->begin(9600); // Sender
    waitForUser(5); // Give usr time to open serial terminal
    gSerialStdPtr->println("XBee-Receiver-setup");
    pinMode...