I have a Node and Receiver shield that I am connecting to an an Arduino Uno. I have connected a TMP36 temp senor to pad 1 on the node and am trying to read it, but the value that the Uno is picking up from the reciever shield is not what I am expecting to see. It is reading 36. It varies as I warm up or cool done the sensor. I also get values from the node on pads 2 and 3 with nothing connected to them. The values are 67 and 79. When I connect the temp sensor straight to the Uno and analogRead() the sensor, I get 143, which corresponds to the right temp, so I know the sensor is working correctly. I am using the NodeLogger code from the WickedReceiver library from the website. I can't seem to figure out what I am doing wrong. Any ideas? Should the Node be reading the analog value of the sensor in decimal form? Any ideas?
Here is the code I am using:
define RADIO_BAUD_RATE 2400
define UART_BAUD_RATE 115200
include
define FILTER_NODE_ID 15
WickedReceiver receiver;
int rx_status = 0;
int numBytesAvailable = 0;
int incomingByte = 0;
long now = 0;
byte flag = -1;
void setup(){
Serial.begin(UART_BAUD_RATE);
Serial.println("Hello World");
Serial.flush();
delay(1000);
Serial.begin(RADIO_BAUD_RATE);
}
void loop(){
numBytesAvailable = Serial.available();
for(int ii=0; ii < numBytesAvailable; ii++){
incomingByte = Serial.read();
rx_status = receiver.processEncodedByte(incomingByte);
if(rx_status == 1){
printRadioPacket();
// do other stuff with the packet
receiver.nextPacket();
}
}
}
void printRadioPacket(){
Serial.flush();
delay(1000);
Serial.begin(UART_BAUD_RATE);
//print using random access
Serial.println();
Serial.print(millis(), DEC);
Serial.print("\t\t");
for(int i = 0; i < 8; i++){
Serial.print(receiver.getDecodedByte(i), DEC);
Serial.print("\t");
}
Serial.println();
Serial.print("\t");
Serial.print("\t");
Serial.print(receiver.getDecodedNodeId(), DEC);
Serial.print("\t");
Serial.print(receiver.getDecodedPacketNumber(), DEC);
Serial.print("\t");
Serial.print("\t");
Serial.print(receiver.getDecodedSensor1(), DEC);
Serial.print("\t");
Serial.print(receiver.getDecodedSensor2(), DEC);
Serial.print("\t");
Serial.print(receiver.getDecodedSensor3(), DEC);
Serial.print("\t");
Serial.print(receiver.getDecodedDigitalCount(), DEC);
Serial.println();
Serial.flush();
delay(1000);
Serial.begin(RADIO_BAUD_RATE);
}