Hi, Have had my whisper nodes for a while and now just getting around to doing something.
I am looking at adding a few DS18B20 sensors and with an environmental sensor (press and humid), after looking at the Voltage node example I have a few questions about the protocol/ msg format.
Obviously I can just add the library I need, dependant of course on the compiled size and insert the relevant setup and loop routines.
My first questions regarding the code snippet below,
Just wanting to understand the msg format more.
The first four are easy, msg format, node and base address for comms. But am curious about the data ones
So I want to add for example two temps and a humidity, can I just adjust the prepare msg to include my temps etc and then change the msg length to suit???
Apologies for all the question just couldn't see anything directly relating to the protocol and msg make up...
Regards Paul
I am looking at adding a few DS18B20 sensors and with an environmental sensor (press and humid), after looking at the Voltage node example I have a few questions about the protocol/ msg format.
Obviously I can just add the library I need, dependant of course on the compiled size and insert the relevant setup and loop routines.
My first questions regarding the code snippet below,
- Does this section send two messages ? one with voltage 1 and another with voltage 2?.
- what is the purpose of myMsg.sdx as it is not in the prepare msg section, but I can see it in the T2message protocol section of the Library
Code: Select all
if(supply == 1)
{
voltage = T2Utils::readVoltage(T2_WPN_VBAT_VOLTAGE, T2_WPN_VBAT_CONTROL);
myMsg.sdx = 0x64; // Battery
}
if(supply == 2)
{
voltage = T2Utils::readVoltage(T2_WPN_VIN_VOLTAGE, T2_WPN_VIN_CONTROL);
myMsg.sdx = 0x65; // Supply
}The first four are easy, msg format, node and base address for comms. But am curious about the data ones
- myMsg.data[0] = 0x01; // Operation Last Reading .what role function does this play
- myMsg.data[1] = 0x01; // Battery/Supply Index, if multiple supplies. does I change this for two voltages ??
- myMsg.data[2] = voltage >> 8; why the bitshift right ??
- myMsg.data[3] = voltage; other part of the voltage meausrement
- myMsg.len = 4; //Update length[/code] data length
Code: Select all
// Prepare Message
myMsg.cmd = 0x00;
myMsg.idx = 0x06;
myMsg.src = nodeAddr;
myMsg.dst = baseAddr;
myMsg.data[0] = 0x01; // Operation Last Reading
myMsg.data[1] = 0x01; // Battery/Supply Index, if multiple supplies
myMsg.data[2] = voltage >> 8;
myMsg.data[3] = voltage;
myMsg.len = 4; //Update lengthSo I want to add for example two temps and a humidity, can I just adjust the prepare msg to include my temps etc and then change the msg length to suit???
Apologies for all the question just couldn't see anything directly relating to the protocol and msg make up...
Regards Paul
