Author Topic: GZLL communication problem  (Read 84 times)

hopperms

  • RFduino Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
GZLL communication problem
« on: December 15, 2017, 12:42:13 PM »
Hi,

I'm trying to write what should be some really simple code but it's not working for some reason. Basically, I'm just trying to use 2 RFduinos for wireless communication. One receives data through UART, transmits through GZLL to the other, which receives and outputs the data through UART, and vice versa.

Right now, I'm able to send data from the device to the host without issue, but trying to send from host to device doesn't get through and just outputs gibberish back through the host's UART. Anyone seeing something I'm missing?

Host:
Code: [Select]
#include <RFduinoGZLL.h>

device_t role = HOST;

void setup()
{
  RFduinoGZLL.begin(role);
  Serial.begin(9600);
}

void loop()
{
  if(Serial.available() > 0){
    RFduinoGZLL.sendToDevice(DEVICE0, Serial.read());
  }
}

void RFduinoGZLL_onReceive(device_t device, int rssi, char *data, int len)
{
  if(device == DEVICE0){
    Serial.write(data[0]);
  }
}

Device:
Code: [Select]
#include <RFduinoGZLL.h>

device_t role = DEVICE0;

void setup()
{
  RFduinoGZLL.begin(role);
  Serial.begin(9600);
}

void loop()
{
  if(Serial.available() > 0){
    RFduinoGZLL.sendToHost(Serial.read());
  }
}

void RFduinoGZLL_onReceive(device_t device, int rssi, char *data, int len)
{
    Serial.write(data[0]);
}

Thanks