868LP 06a: Expansion board TX

This example shows how to use the XBee 868LP which is connected to the Expansion board (SOCKET1)

Required Materials

1 x Waspmote 1 x Battery 1 x MiniUSB wire 1 x XBee 868LP

Notes

- The battery has to be connected. - This example can be executed in Waspmote v15

Code

/*  
 *  ------   [868LP_06a] - Use of Expansion board     -------- 
 *  
 *  Explanation: This example shows how to use the XBee 868LP
 *  which is connected to the Expansion board (SOCKET1)
 *  
 *  Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L. 
 *  http://www.libelium.com 
 *  
 *  This program is free software: you can redistribute it and/or modify 
 *  it under the terms of the GNU General Public License as published by 
 *  the Free Software Foundation, either version 3 of the License, or 
 *  (at your option) any later version. 
 *  
 *  This program is distributed in the hope that it will be useful, 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 *  GNU General Public License for more details. 
 *  
 *  You should have received a copy of the GNU General Public License 
 *  along with this program.  If not, see . 
 *  
 *  Version:           3.0
 *  Design:            David Gascón 
 *  Implementation:    Yuri Carmona
 */
 
#include <WaspXBee868LP.h>

// Destination MAC address
//////////////////////////////////////////
char RX_ADDRESS[] = "0013A200407B5660";
//////////////////////////////////////////

// create data fields for each packet
char data[] = "this_is_a_message";

// define variable
uint8_t error;



void setup()
{
  // Init USB port
  USB.ON();
  USB.println(F("Send messages via Expansion Board"));

  //////////////////////////
  // 1. init XBees
  //////////////////////////
  
  // 1.2. initiliaze object in SOCKET1
  xbee868LP.ON( SOCKET1 );  

}

void loop()
{ 
  
  //////////////////////////////////////
  // 2. send packet via SOCKET1 
  //////////////////////////////////////

  // send XBee packet
  error = xbee868LP.send( RX_ADDRESS, data );   
  
  // check TX flag
  if( error == 0 )
  {
    USB.println(F("send ok"));
    
    // blink green LED
    Utils.blinkGreenLED();    
  }
  else 
  {
    USB.println(F("send error"));
    
    // blink red LED
    Utils.blinkRedLED();    
  }
  
  // wait for five seconds
  delay(5000);


}

Output

H#
Send messages via Expansion Board
send ok
send ok
...

Last updated