I’m using Adafruit LoRa Feather M0 and I would like to send temperature and battery level to my gateway. I need a little bit help on coding. I can easily send an integer number but I can not combine two numbers in a packet. Also I’m having trouble on how to send a floating point number. Here is what I have so far:
float measuredvbat = analogRead(VBATPIN); measuredvbat *= 2; // we divided by 2, so multiply back measuredvbat *= 3.3; // Multiply by 3.3V, our reference voltage measuredvbat /= 1024; // convert to voltage Serial.print("VBat: " ); Serial.println(measuredvbat); float tempC= getTempC(); char radiopacket; itoa(tempC,radiopacket,10); Serial.print("Temp is: " ); Serial.println(tempC); Serial.print("Temp is: " ); Serial.println(radiopacket); LMIC_setTxData2(1, (uint8_t *)radiopacket, sizeof(radiopacket)-1, 0); Serial.println(F("Packet queued"));
Any help would be appreciated.