I can hold the data as a float if I need to,
I am using the sensornet example from the RF24network lib.
here is the code
void loop(void)
{
// Update objects
theUpdater.update();
// Pump the network regularly
network.update();
// If we are the base, is there anything ready for us?
while ( network.available() )
{
// If so, grab it and print it out
RF24NetworkHeader header;
S_message message;
// network.read(header,&message,sizeof(message));
network.read(header,&message,sizeof(message));
printf_P(PSTR("%lu: APP Received #%u %s from 0%o\n\r"),millis(),header.id,message.toString(),header.from_node);
// printf_P(PSTR("%lu: #%u %s from 0%o\n\r"),millis(),header.id,message.toString(),header.from_node);
//Serial.println(header.id);
rec = header.from_node -1;
Serial.println(message.toString());
Serial.println(rec);
}
// If we are the kind of node that sends readings, AND it's time to send
// a reading AND we're in the mode where we send readings...
if ( this_node.address > 0 && ( ( Sleep && ! test_mode ) || send_timer.wasFired() ) && ! calibration_mode && ! startup_leds )
{
// Transmission beginning, TX LED ON
Yellow = true;
if ( test_mode )
{
Green = false;
Red = false;
}
int i;
S_message message;
// Take the temp reading
i = num_measurements;
uint32_t reading = 0;
while(i--)
reading += analogRead(temp_pin);
// Convert the reading to celcius*256
// This is the formula for MCP9700.
// C = reading * 1.1
// C = ( V - 1/2 ) * 100
message.temp_reading = ( reading ) >> 16;
// Take the voltage reading
i = num_measurements;
reading = 0;
while(i--)
reading += analogRead(voltage_pin);
// Convert the voltage reading to volts*256
message.voltage_reading = analogRead(voltage_pin);
printf_P(PSTR("---------------------------------\n\r"));
printf_P(PSTR("%lu: APP Sending %s to 0%o...\n\r"),millis(),message.toString(),0);
// Send it to the base
RF24NetworkHeader header(/*to node*/ 0, /*type*/ test_mode ? 's' : 'S');
bool ok = network.write(header,&message,sizeof(message));
if (ok)
{
if ( test_mode )
Green = true;
printf_P(PSTR("%lu: APP Send ok\n\r"),millis());
}
else
{
if ( test_mode )
Red = true;
printf_P(PSTR("%lu: APP Send failed\n\r"),millis());
}
// Transmission complete, TX LED OFF
Yellow = false;
if ( Sleep && ! test_mode )
{
// Power down the radio. Note that the radio will get powered back up
// on the next write() call.
radio.powerDown();
// Be sure to flush the serial first before sleeping, so everything
// gets printed properly
Serial.flush();
// Sleep the MCU. The watchdog timer will awaken in a short while, and
// continue execution here.
Sleep.go();
}
}
// Button
unsigned a = ButtonA.wasReleased();
if ( a && a < 500 )
{
// Pressing the button during startup sequences engages test mode.
// Pressing it after turns off test mode.
if ( startup_leds )
test_mode = true;
else if ( test_mode )
{
test_mode = false;
Green = false;
Red = false;
}
else if ( calibration_mode )
{
calibration_mode = false;
test_mode = true;
calibration_leds.disable();
}
}
// Long press
if ( ButtonLong.wasPressed() && test_mode )
{
test_mode = false;
calibration_mode = true;
calibration_leds.reset();
}
// Listen for a new node address
nodeconfig_listen();
}
The data can be stored as a double or a float. As long as I can do maths on it. I'm reading the data from remote arduino's talking over the Nordic nRF24L01+ radios. and I want the central arduino to display the values on a local LCD display.