How to send simple Temperature DS18B20 Value to Sigfox backend

Hello,

I am a newbie.

I am want to try something with MKRFOX1200.

I read a Onewire temperature sensor and want to send it to the Sigfox backend.

How is the SigFox.write() command?

I read something about sigfox_message but do not understand (SigFox/WeatherMonitor) the conversions = uint16_t...

I have the problem to understand how to convert a temperature value in a variable to send it with SigFox.write().

Thanks a lot!

Christoph

Hi,
here is the bare minimum of what you have in mind

#include <ArduinoLowPower.h>
#include <SigFox.h>
#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 5

OneWire ourWire(ONE_WIRE_BUS);
DallasTemperature sensors(&ourWire);


void setup() {
  SigFox.begin();

}
  

void loop() {
  sensors.requestTemperatures();
  float tempAktuellfloat = sensors.getTempCByIndex(0);  
    
    SigFox.beginPacket();
    SigFox.write ( tempAktuellfloat );
    SigFox.endPacket();     
    
    //LowPower.sleep(30000);
    delay (30000);
        

}

i use thinger.io and thingspeak as free server for visualisation but there are a lot other provider
thinger have a great documentation for beginner
hope it helps

for the variable types:

byte 0 to 255 8bit
char -128 to 127 8bit
int8_t -128 to 127 8bit
uint8_t 0 to 255 8bit
int16_t -32,768 to 32,767 16bit
uint16_t 0 to 65,535 16bit
int32_t -2,147,483,648 to 2,147,483,647

i think where you live the temperatures are between -20 and +40 C, so int8_t works
if you need a float, its similar
the simple "int" in arduino changes with the board, 16 or 32 bit
for better answers ask google, but this is the way you have to think about variables

have a look at introduction-to-arduino-mkrfox1200-part-1