I'm trying to send the rfm69w build-in temperature reading to other. Whenever I printed the the temperature, the serial monitor shown ***** before each reading. Any one know how to avoid it?
*****82.40
*****84.20
*****82.40
*****82.40
*****82.40
*****82.40
#include <RFM69.h>
#include <SPI.h>
#include <SPIFlash.h>
#define NODEID 99
#define NETWORKID 100
#define GATEWAYID 1
#define FREQUENCY RF69_915MHZ //Match this with the version of your Moteino! (others: RF69_433MHZ, RF69_868MHZ)
#define KEY "thisIsEncryptKey" //has to be same 16 characters/bytes on all nodes, not more not less!
#define LED 9
#define SERIAL_BAUD 115200
#define ACK_TIME 30 // # of ms to wait for an ack
int TRANSMITPERIOD = 10000; //transmit a packet to gateway so often (in ms)
byte sendSize=0;
boolean requestACK = false;
SPIFlash flash(8, 0xEF30); //EF40 for 16mbit windbond chip
RFM69 radio;
typedef struct {
float temp1; //temperature maybe?
float temp2;
float temp3;
} Payload;
Payload theData;
void setup() {
Serial.begin(SERIAL_BAUD);
radio.initialize(FREQUENCY,NODEID,NETWORKID);
//radio.setHighPower(); //uncomment only for RFM69HW!
radio.encrypt(KEY);
char buff[50];
sprintf(buff, "\nTransmitting at %d Mhz...", FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915);
//Serial.println(buff);
}
long lastPeriod = -1;
void loop() {
int currPeriod = millis()/TRANSMITPERIOD;
if (currPeriod != lastPeriod)
{
byte temperature = radio.readTemperature(-1); // -1 = user cal factor, adjust for correct ambient
theData.temp1 = 1.8 * temperature + 32; // 9/5=1.8
Serial.println(theData.temp1);
if (radio.sendWithRetry(GATEWAYID, (const void*)(&theData), sizeof(theData)))
Serial.println();
Blink(LED,3);
lastPeriod=currPeriod;
}
}
void Blink(byte PIN, int DELAY_MS)
{
pinMode(PIN, OUTPUT);
digitalWrite(PIN,HIGH);
delay(DELAY_MS);
digitalWrite(PIN,LOW);
}
It's coming from the library - https://github.com/LowPowerLab/RFM69/blob/master/RFM69.cpp
Line 417:
while ((readReg(REG_TEMP1) & RF_TEMP1_MEAS_RUNNING)) Serial.print('*');
Whenever the temperature is below 32F, the build-in temp sensor is reading some weird numbers like 475, 498........ Have any idea what's wrong with it? thanks