This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Connection

hello i have a problem i send from device to host the temperature, but it send the temperarture just one time and i want that the device should send it every 10 seconds is it possible?

here are the source code for the device and host

code for device

#include <RFduinoBLE.h> #include <RFduinoGZLL.h>

device_t role = DEVICE0;

void setup() {

// start the GZLL stack RFduinoGZLL.begin(role); }

void loop() {

RFduino_ULPDelay(SECONDS(10)); char temp = RFduino_temperature(CELSIUS); RFduinoGZLL.sendToHost(temp);

}

void RFduinoGZLL_onReceive(device_t device, int rssi, char*data, int len) { }

code for host

#include <RFduinoBLE.h> #include <RFduinoGZLL.h>

device_t role = HOST;

void setup() { Serial.begin(9600);

RFduinoGZLL.begin(role); }

void loop() { }

void RFduinoGZLL_onReceive(device_t device, int rssi, char*data, int len) { float temp = data[0] ;

if (device == DEVICE0) Serial.println(temp); delay(1);

}

Related