You are reading a single comment by @countxerox and its replies. Click here to read the full conversation.
  • Hi, I'm writing some code for my Pico with an ESP8266 which sends temperature and humidity sensor readings to a Google Form (like this tutorial).

    I'm using a DHT11 sensor like this...

    var dht = require("DHT11").connect(C11);
    dht.read(function (a) {Temp = a.temp.toString();Humidity = a.rh.toString();});
    

    Then next I send the Temp and Humidity to Google like this...

    sendForm(Temp, Humidity);
    

    but the sensor hasn't finished reading yet, it's to soon to send the data. I can use setTimeout to wait a couple of seconds before sending, that works, but I'm thinking I need learn how to use a callback but I can't work out how to write it.

About

Avatar for countxerox @countxerox started