You are reading a single comment by @jimr1603 and its replies. Click here to read the full conversation.
  • I might try turning this into a full-blown tutorial for the pages, but in case that never gets started, here's the code I've copy-pasted together:

    
    var temperature;
    var humidity;
    
    var dht = require("DHT22").connect(D2);
    
    function onPage(req, res){
      var page = temperature + "," + humidity;
        res.writeHead(200, {'Content-Type': 'text/html'});
        res.end(page);
    }
    
    function writeScreen(){
      g.clear();
     g.drawString(temperature, 0, 0); 
      g.drawString(humidity, 0, 30);
     g.flip();
    }
    // I2C
    I2C1.setup({scl:D5,sda:D4});
    var g = require("SSD1306").connect(I2C1, writeScreen);
    g.setFont("4x6", 5);
    
    function readDHT(){
      dht.read(function(a) {
       temperature = a.temp.toString();
        humidity = a.rh.toString();
        console.log("Temp is "+a.temp.toString()+" and RH is "+a.rh.toString());
      });
      writeScreen();
    }
    
    
    setInterval(readDHT, 2000);
    
    require("http").createServer(onPage).lis­ten(80);
    
    

    My node.red asks http://esp_hostname.local for the page, and parses it as csv.

About

Avatar for jimr1603 @jimr1603 started