#include #include #include "xbee_wrapper.h" #include "packet.h" #define WAVE_TIMEOUT 5000 // Peripherals LiquidCrystal_I2C screen(0x27, 16, 2); XBeeWrapper xbee = XBeeWrapper(); // ACTUAL DATA uint8_t wave_id = 250; Packet send; void setup() { Serial.begin(38400); Serial.println("+ ready"); screen.begin(); screen.backlight(); xbee.begin(38400); } void loop() { delay(WAVE_TIMEOUT); screen.clear(); screen.print("+ wave"); screen.print(wave_id+1); // increment wave id (will overflow from 255 to 0) send.setOpcode(0); send.setWave(++wave_id); send.setDist(0); if( xbee.broadcast(send) == XBWSEND_OK ) Serial.println("sent"); else Serial.println("failed"); }