-
• #2
Sorry, there is an issue with
setwatch
and that is probably what the DHT module is using.It has been raised on GitHub, however no one has sorted it out.
-
• #3
^^ this - DHT11 and DHT22 definitely use setWatch (and also clearWatch)
-
• #4
You mean this issue on github? https://github.com/espruino/Espruino/issues/643
Is there any ETA to fix this?
-
• #5
It's this one: https://github.com/espruino/Espruino/issues/1176
setWatch
works fine on ESP8266.I'm afraid there's no ETA. Nobody makes anything off the ESP8266 or ESP32 ports, so it's very much a free-time project by members of the Espruino community like @Wilberforce. It'll get fixed when they feel like it or have a need for it in one of their own projects :)
If you need something where someone takes an active role in fixing issues then get an official Espruino board - they're a little more expensive, but that directly pays my salary so I can work full-time to make sure things get fixed in a timely manner :)
-
• #6
Ah okay :) Sorry! I guess I have to switch to another solution in the meanwhile. But that projects is very promising!
-
• #7
The
setwatch
issue has been fixed.It will be in version 1v95, so for now a latest travis build will work:
http://www.espruino.com/binaries/travis/master/ -
• #8
wow, thank you! :)
-
• #9
I have nearly the exace same problem.
I have baught and received one of those cheap TTGO ESP32 with OLED and batterypack two days ago.
I have downloaded 1v95, setup my folders/project and previously with the ESP8622 i had used thingssdk as a toolchain so i could stay in my editor, but that didn't work anymore with the ESP32. So i changed to the IDE, which is ... well it is something, but i prefer sublime and a console. And it seems slower than before. But i can live with that.So far the OLED runs without any change to my old code, great! But the DHT22 makes me sad.
My code is basically that from the OP, i have connected the D-pin from the DHT with D15 on my board, i even threw in a 10kRes.
but all i get is a checksumError:#3987[r1,l1] Object { #4008[r1,l2] Name String [1 blocks] "err" #4007[r1,l1] Bool true #4009[r1,l2] Name String [2 blocks] "checksumError" #3994[r1,l1] Bool false #3986[r1,l2] Name String [1 blocks] "raw" #4005[r2,l1] String [1 blocks] "" #4010[r1,l2] Name String [1 blocks] "temp"= int -1 #4018[r1,l2] Name String [1 blocks] "rh"= int -1 }
so i guess i managed to damage my DHT or am i missing sth?
mycode:
let pin_DHT22 = D15; // D-out DHT22 const DHT = require('DHT22').connect(pin_DHT22); // const intval_temp_measure = 10 * 1000; // every n second let intval_temp_measure_id = null; // const measureInterval = function() { DHT.read(function (a) { if(a.err) { trace(a); } let temp = a.temp.toString(); let rh = a.rh.toString(); //if(a.raw.length > 3) drawMeasurement(temp, rh); }); }; // let temps = []; // store temperature data for some time // let sig = false; const drawMeasurement = function(temp, rh){ // wipe clean OLED.clear(); if(temp === undefined) { OLED.setFontBitmap(); OLED.setFont8x12(); OLED.drawString('Warte auf Daten ...', 1, 1); } else { if(temps.length >= 124) { // we can only draw so much on the x-axis temps.shift(); // remove first entry } temps.push(temp); // draw chart: // we have: x => 2 -> 126 and y => 22 -> 62 for(var t = 0; t < temps.length; t++) { var y = temps[t] + 22 ; var x = t + 2; } // OLED.setFontBitmap(); // OLED.setFont8x12(); // OLED.drawString('Aktuelle Temperatur:', 0, 0); // OLED.setFontVector(15); OLED.drawString(temp + ' C', 1, 1); // // OLED.setFontBitmap(); // OLED.setFont8x12(); // OLED.drawString('Luftfeuchtigkeit:', 0, 15); // OLED.setFontVector(12); OLED.drawString(rh + ' %', 74, 2); } // draw some borders /* ________|________ | | | | |________________| */ // x1 y1 x2 y2 OLED.drawLine(64, 0, 64, 21); OLED.drawLine(0, 21, 127, 21); OLED.drawLine(0, 21, 0, 64); OLED.drawLine(127, 21, 127, 64); OLED.drawLine(0, 63, 127, 63); // refresh OLED.flip(); return 'temp.: ' + temp + ' C, hum.: ' + rh + ' %'; }; // ------------------------------------------------ let pin_OLED_SCL = D4; // onboard let pin_OLED_SDA = D5; // onboard // PRECONF I2C1.setup({ scl: pin_OLED_SCL, sda: pin_OLED_SDA }); require('Font8x12').add(Graphics); let OLED = null; // function testOLED(){ log('writing on OLED'); OLED.clear(); //OLED.setFontBitmap(); OLED.setFont8x12(); // write some text OLED.drawString("loading ...", 2, 2); // write to the screen OLED.flip(); } function main () { log('main started'); let OLED_options = { address: 0x3C }; OLED = require("SSD1306").connect(I2C1, testOLED, OLED_options); //OLED.off(); intval_temp_measure_id = setInterval(measureInterval, intval_temp_measure); measureInterval(); } function init() { //OLED.on(); log('program start ...'); main(); } setTimeout(init, 1500);
Hey guys,
thank you for this great project! Currentyl I'm just playing around with some sensors with my ESP32. I'm pretty new to microcontrollers.
I just got a SSD1306 working with espruino on my ESP32, it works flawless. Yesterday I had to connect a DHT22 and my ESP32 keeps crashing after a few measurements of the temp. This code isn't that spectacular, but I really don't know why its crashing. I always get that message:
After the core dump I see:
It doesn't matter how often I read the DHT. It crashes after two measurements and after none.
The DHT is connected to GPIO15 with a pullup resistor (10k). It keeps crashing even without WiFi and a webserver. You can see my wiring (without the oled) attached.
My code:
Does anybody of you have a clue?
1 Attachment