900 HP Networking Guide
Development website
  • Initial page
  • Introduction
  • Hardware
  • General considerations
  • Initialization
  • Node parameters
  • Power gain and sensitivity
  • Networking methods
  • Node discovery
  • Sleep Mode
  • Security and data encryption
  • Certifications
  • Code examples and extended information
  • API changelog
  • Documentation changelog
Powered by GitBook
On this page

Was this helpful?

Code examples and extended information

PreviousCertificationsNextAPI changelog

Last updated 4 years ago

Was this helpful?

In the Waspmote Development section you can find complete examples:

Example:

#include <WaspXBee900HP.h>
#include <WaspFrame.h>
// Destination MAC address
//////////////////////////////////////////
char RX_ADDRESS[] = “0013A20040A63E21”;
//////////////////////////////////////////
// Define the Waspmote ID
char WASPMOTE_ID[] = “node_01”;
// define variable
uint8_t error;
void setup()
{
 // init USB port
 USB.ON();
 USB.println(F(“Sending packets example”));
 // store Waspmote identifier in EEPROM memory
 frame.setID( WASPMOTE_ID );
 // init XBee
 xbee900HP.ON();
}
void loop()
{
 ///////////////////////////////////////////
 // 1. Create ASCII frame
 ///////////////////////////////////////////
 // create new frame
 frame.createFrame(ASCII);

 // add frame fields
 frame.addSensor(SENSOR_STR, “new_sensor_frame”);
 frame.addSensor(SENSOR_BAT, PWR.getBatteryLevel());

 // show frame to send
 frame.showFrame();
 ///////////////////////////////////////////
 // 2. Send packet
 ///////////////////////////////////////////
 // send XBee packet
 error = xbee900HP.send( RX_ADDRESS, frame.buffer, frame.length );

 // check TX flag
 if( error == 0 )
 {
 USB.println(F(“send ok”));
 }
 else
 {
 USB.println(F(“send error”));
 }

 // wait for five seconds
 delay(5000);
}
http://www.libelium.com/development/waspmote/examples