-
Hello,
I was evaluating if the digitalPulse() (on ESP32 v2.00) timing would meet the requirements of a project and found that:
pinMode(D32, 'output'); setInterval(()=> { digitalPulse(D5, 1, 2); }, 50);
Produces pulses from about 2096us to 2160us.
Being generated by hardware I wonder if it can do any better. Maybe the original espruino does not have the jitter?
Thank you.
-
Thanks for the links.
I started with espruino/js last March to build my final year project course in industrial automation. It had mqtt and node-red plus some hardware access in the espruino side.
The goal is to build over tinydash by Gordon and be able to edit JSON data of a bigger system that is not connected to the internet. For now I have only clues of how to proceed... from scratch drawing on the canvas or chrome web-kit or something else?
Two of the widgets would be 2d table edit and 3d plot.
I´ve done it in VB6 long time ago and I remember that gradient filling was slow.
VS code is my choice over notepad because of the syntax highlight and variable completion.
-
Hi @Robin,
Yes I have been playing with the web ide since I started with espruino.
I come from a C + jtag background doing low level code.
Now, javascript is a new language for me for both the microcontroller and the UI. I´ve found that chrome is good for debugging the browser side js. Espruino debugs with console.log and debugger; Although this last one crashes sometimes.
-
-
Thank you.
As you can see, I am just starting with js/html and am lacking basic knowledge. So I am editing the web page side on the computer using vs code and leaving espruino with the websocket server for now.
The need to access widget data outside of the "o" variable was also for updating it from ws json message.
EDIT: TD.update and add name field to TD.value.I plan to use the dashboard to display and change variables. Will probably need to create new dash widgets like a scrollbar and a slider.
-
Hello everybody,
I am working on getting the tinydash https://github.com/espruino/TinyDash working with espruino over websockets.
I am able to connect a browser to espruino and exchange messages, but I do not know how to catch the dash control events like onchange to send a message to espruino.
When the page is finished I will inline all files and store it in the flash.
Searching the forum for tinydash does not get me results. Is anybody else using it?
index.html
<html> <head> <meta name="viewport" content="width=640, initial-scale=1"> </head> <body> <link href="tinydash.css" rel="stylesheet"> <script src="tinydash.js"></script> <script> var ws; setTimeout(function() { var ws = new WebSocket('ws://192.168.25.4:8000',"protocolOne"); ws.onmessage = function (event) { console.log("MSG:"+event.data); //document.write("MSG:"+event.data); }; setTimeout(function() { ws.send("Hello to Espruino!"); }, 1000); }, 1000); var o = { t:TD.toggle({x:10,y:150,width:200,height:60,label:"Toggle",value:1,name:"toggle"}), v:TD.value({x:10,y:220,width:200,height:60,label:"Value",value:"1.234"}), b:TD.button({x:10,y:290,width:200,height:100,label:"Press Me",value:0,name:"button",onchange:function(e){o.log.log("Pressed!");}}), vs:TD.value({x:10,y:400,width:200,height:60,label:"Steppable Value",value:"1.2",min:1,step:0.1,max:2}), }; for (var i in o) document.body.appendChild(o[i]); //TD.toggle.onchange = function(ev) { ws.send(1); //}; </script> </body> </html>
Espruino code:
ws.jsfunction wsConnect() { var server = require('ws').createServer(onPageRequest); server.listen(8000); server.on("websocket", function(ws) { ws.on('message',function(msg) { print("WS: "+JSON.stringify(msg)); }); ws.send("WS: Hello from Espruino!"); }); } function wifiConnect() { wifi = require('Wifi'); wifi.connect(wifi_options.ssid, { password: wifi_options.password }, function(e) { if (e) { console.log("WIFI: " + e); } }); wifi.on('connected', function() { console.log('WIFI:', wifi.getIP()); setTimeout(function() { wsConnect(); }, 1000); }); wifi.on('disconnected', function() { console.log("WIFI: Reconectando..."); wifi.connect(wifi_options.ssid, {password: wifi_options.password}); }); } var page = '<html><body><script>var ws;setTimeout(function(){ws=new WebSocket("ws://"+location.host+"/my_websocket","protocolOne");ws.onmessage=function(event){console.log("MSG:"+event.data);};setTimeout(function(){ ws.send("Hello to Espruino!");},1000);},1000);</script></body></html>'; function onPageRequest(req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.end(page); } function onInit() { wifiConnect(); }
-
-
It is the esp32 wroom module in a single chip.
https://www.espressif.com/sites/default/files/documentation/esp32-pico-d4_datasheet_en.pdf
All it needs are the antenna and its matching components.
-
-
-
-
-
-
-
-
It is the espruino_1v96.21_esp32.bin.
A bit more info on that... Just inject noise on D34.
/mnt/c/Users/rhys/esp32/edge/EspruinoBuildTools/esp32/build/esp-idf/components/freertos/./queue.c:1613 (xQueueReceiveFromISR)- assert failed!
Guru Meditation Error of type StoreProhibited occurred on core 0. Exception was unhandled.
Register dump:
PC : 0x4000c2e4 PS : 0x00060733 A0 : 0x80084e22 A1 : 0x3ffaeab0
A2 : 0x00000000 A3 : 0x3ffaec70 A4 : 0x40086b8c A5 : 0x00000000
A6 : 0x00000000 A7 : 0x3ffaecd4 A8 : 0x00000000 A9 : 0x3ffaea10
A10 : 0x0000000a A11 : 0x00000000 A12 : 0x00000000 A13 : 0x00001000
A14 : 0x3ffaea03 A15 : 0x3ffaec70 SAR : 0x00000004 EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x040086b7
Backtrace: 0x4000c2e4:0x3ffaeab0 0x40084e1f:0x3ffaeac0 0x40085449:0x3ffaeae0 0x4008283d:0x3ffaeb00 0x4008293d:0x3ffaeb30 0x400d3352:0x3ffaeb50 0x40082a18:0x3ffaeb70 0x40114b15:0x3ffaeb90 0x40082d08:0x3ffaebb0 0x40082be4:0x3ffaebe0 0x40082ce2:0x3ffaec00var ssid = 'xxxx'; var password = 'xxxxxx'; var wifi = require('Wifi'); wifi.connect(ssid, {password: password}, function() { console.log('Connected to Wifi. IP address is:', wifi.getIP().ip); wifi.save(); }); pinMode(D34,"input_pullup"); pinMode(D39,"input_pullup"); pinMode(D32,"output"); pinMode(D33,"output"); pinMode(D12,"input_pulldown"); var times = { volp:[ 4.4,4.2,.64,1.6,.64,1.6,.69,1.6,.67,.45,.68,.44,.64,.43,.64,.44,.67,.45,.67,1.6,.64,1.6,.64,1.6,.67,.45,.64,.45,.67,.45,.67,.44,.67,.45,.69,1.54,.68,1.56,.64,.44,.64,1.56,.67,.46,.67,.45,.68,.44,.64,.44,.67,.45,.66,.46,.66,1.57,.64,.44,.68,1.56,.64,1.56,.67,1.57,.64,1.56,.64,46.74,4.6,4.42,.64,1.56,.69,1.56,.67,1.56,.69,.43,.69,.43,.64,.45,.68,.44,.68,.43,.69,1.55,.64,1.56,.64,1.57,.68,.45,.67,.42,.71,.42,.69,.43,.68,.45,.67,1.56,.64,1.56,.68,.44,.64,1.56,.69,.43,.64,.44,.64,.43,.69,.43,.64,.44,.67,.45,.67,1.6,.64,.44,.67,1.57,.67,1.6,.68,1.6,.64,1.6,.64], volm:[ 4.4,4.2,.64,1.6,.64,1.6,.69,1.6,.67,.45,.68,.44,.64,.43,.64,.44,.67,.45,.67,1.6,.64,1.6,.64,1.6,.67,.45,.64,.45,.67,.45,.67,.44,.67,.45,.69,1.54,.68,1.56,.64,.44,.64,1.56,.67,.46,.67,.45,.68,.44,.64,.44,.67,.45,.66,.46,.66,1.57,.64,.44,.68,1.56,.64,1.56,.67,1.57,.64,1.56,.64,46.74,4.6,4.42,.64,1.56,.69,1.56,.67,1.56,.69,.43,.69,.43,.64,.45,.68,.44,.68,.43,.69,1.55,.64,1.56,.64,1.57,.68,.45,.67,.42,.71,.42,.69,.43,.68,.45,.67,1.56,.64,1.56,.68,.44,.64,1.56,.69,.43,.64,.44,.64,.43,.69,.43,.64,.44,.67,.45,.67,1.6,.64,.44,.67,1.57,.67,1.6,.68,1.6,.64,1.6,.64], vola:[ 4.4,4.2,.64,1.6,.64,1.6,.69,1.6,.67,.45,.68,.44,.64,.43,.64,.44,.67,.45,.67,1.6,.64,1.6,.64,1.6,.67,.45,.64,.45,.67,.45,.67,.44,.67,.45,.69,1.54,.68,1.56,.64,.44,.64,1.56,.67,.46,.67,.45,.68,.44,.64,.44,.67,.45,.66,.46,.66,1.57,.64,.44,.68,1.56,.64,1.56,.67,1.57,.64,1.56,.64,46.74,4.6,4.42,.64,1.56,.69,1.56,.67,1.56,.69,.43,.69,.43,.64,.45,.68,.44,.68,.43,.69,1.55,.64,1.56,.64,1.57,.68,.45,.67,.42,.71,.42,.69,.43,.68,.45,.67,1.56,.64,1.56,.68,.44,.64,1.56,.69,.43,.64,.44,.64,.43,.69,.43,.64,.44,.67,.45,.67,1.6,.64,.44,.67,1.57,.67,1.6,.68,1.6,.64,1.6,.64], volb:[ 4.4,4.2,.64,1.6,.64,1.6,.69,1.6,.67,.45,.68,.44,.64,.43,.64,.44,.67,.45,.67,1.6,.64,1.6,.64,1.6,.67,.45,.64,.45,.67,.45,.67,.44,.67,.45,.69,1.54,.68,1.56,.64,.44,.64,1.56,.67,.46,.67,.45,.68,.44,.64,.44,.67,.45,.66,.46,.66,1.57,.64,.44,.68,1.56,.64,1.56,.67,1.57,.64,1.56,.64,46.74,4.6,4.42,.64,1.56,.69,1.56,.67,1.56,.69,.43,.69,.43,.64,.45,.68,.44,.68,.43,.69,1.55,.64,1.56,.64,1.57,.68,.45,.67,.42,.71,.42,.69,.43,.68,.45,.67,1.56,.64,1.56,.68,.44,.64,1.56,.69,.43,.64,.44,.64,.43,.69,.43,.64,.44,.67,.45,.67,1.6,.64,.44,.67,1.57,.67,1.6,.68,1.6,.64,1.6,.64], volc:[ 4.4,4.2,.64,1.6,.64,1.6,.69,1.6,.67,.45,.68,.44,.64,.43,.64,.44,.67,.45,.67,1.6,.64,1.6,.64,1.6,.67,.45,.64,.45,.67,.45,.67,.44,.67,.45,.69,1.54,.68,1.56,.64,.44,.64,1.56,.67,.46,.67,.45,.68,.44,.64,.44,.67,.45,.66,.46,.66,1.57,.64,.44,.68,1.56,.64,1.56,.67,1.57,.64,1.56,.64,46.74,4.6,4.42,.64,1.56,.69,1.56,.67,1.56,.69,.43,.69,.43,.64,.45,.68,.44,.68,.43,.69,1.55,.64,1.56,.64,1.57,.68,.45,.67,.42,.71,.42,.69,.43,.68,.45,.67,1.56,.64,1.56,.68,.44,.64,1.56,.69,.43,.64,.44,.64,.43,.69,.43,.64,.44,.67,.45,.67,1.6,.64,.44,.67,1.57,.67,1.6,.68,1.6,.64,1.6,.64], }; function analogPulse(pin, value, time, options) { analogWrite(pin, value, options ); setTimeout(function() { digitalWrite(pin, 0); try { options["func"](); } catch(e){ } }, time); } setWatch(function(e) { print('Enviando código'); analogPulse(D13,0.9,100,{freq:38000}); digitalPulse(D16, 0, times.volp); }, D34, {repeat:true, edge:"falling", debounce:100});
-
HI,
Just found that a pushbutton on my dev board failed and I had to touch with a tweezer on its terminals to get my code to run.
setWatch(function(e) { print('Touched!'); }, D34, {repeat:true, edge:"falling", debounce:20});
And it very often gives me:
Guru Meditation Error of type LoadProhibited occurred on core 0.
Exception was unhandled. Register dump: PC : 0x40084912 PS
: 0x00060e33 A0 : 0x80088557 A1 : 0x3ffd7a10 A2 :
0x00000450 A3 : 0x00000000 A4 : 0xe3996419 A5 :
0x00000030 A6 : 0x3ffb2998 A7 : 0x3ffd4cd0 A8 :
0xe3996419 A9 : 0x44041563 A10 : 0x3ffb0b04 A11 :
0x00060e20 A12 : 0x0000001a A13 : 0x4013e3bb A14 :
0x3f419544 A15 : 0x00000000 SAR : 0x00000019 EXCCAUSE:
0x0000001c EXCVADDR: 0xe399641d LBEG : 0x4000c2e0 LEND :
0x4000c2f6 LCOUNT : 0xffffffff Backtrace: 0x40084912:0x3ffd7a10
0x40088554:0x3ffd7a30 0x40088595:0x3ffd7a50 0x40082ae1:0x3ffd7a70
0x4000bef5:0x3ffd7a90 0x40142760:0x3ffd7ab0 0x40141fd8:0x3ffd7ae0
0x4013e3bb:0x3ffd7b40 -
Hi,
I am playing with an esp32 to copy codes from an infra-red controller.
I have been able to timestamp the signal edges and see how the 1's and 0's are encoded and reproduce it with the digitalPulse function.
I can also extract the bit sequence and reconstruct the signal (and avoiding the big timestamp tables).
So I have the timestamp table:
var times = [4.4,4.2,.64,1.6,.64,1.6,.69,1.6,.67,.45,.68,.44,.64,.43,.64,.44,.67,.45,.67,1.6,.64,1.6,.64,1.6,.67,.45,.64,.45,.67,.45,.67,.44,.67,.45,.69,1.54,.68,1.56,.64,.44,.64,1.56,.67,.46,.67,.45,.68,.44,.64,.44,.67,.45,.66,.46,.66,1.57,.64,.44,.68,1.56,.64,1.56,.67,1.57,.64,1.56,.64,46.74,4.6,4.42,.64,1.56,.69,1.56,.67,1.56,.69,.43,.69,.43,.64,.45,.68,.44,.68,.43,.69,1.55,.64,1.56,.64,1.57,.68,.45,.67,.42,.71,.42,.69,.43,.68,.45,.67,1.56,.64,1.56,.68,.44,.64,1.56,.69,.43,.64,.44,.64,.43,.69,.43,.64,.44,.67,.45,.67,1.6,.64,.44,.67,1.57,.67,1.6,.68,1.6,.64,1.6,.64];
Set my carrier with analogWrite().
Make the pulse train with digitalPulse() and the signal looks like the original controller on my scope.
Now, extracting the bits and trying to replay them.
var data = 0b111000001110000000011111; digitalPulse(D16, 0, 4.4); digitalPulse(D16, 1, 4.2); for (var i=23;i>=0;i--) { if (data&(1<<i)) { digitalPulse(D16, 0, .64); digitalPulse(D16, 1, 1.6); } else { digitalPulse(D16, 0, 0.64); digitalPulse(D16, 1, .43); } }
The first 4.4 and 4.2 pulses look good, the next ones take longer than expected. The whole train is like 50% bigger than the first one.
I believe that this is a limitation of the interpreter and I am stuck with the bit timestamp tables.
Is it correct?
-
-
Hi,
Just started using espruino with a olimex esp32-evb.
Serial terminal emulation works fine and I can type in commands, but web ide shows that message.
Unable to retrieve board information. Connection Error?
Connected to port COM3If I reset the board while connected I get...
Unable to retrieve board information. Connection Error?
Connected to port COM3
#ÿAöR$WA82G;dd¤óA"fGDFå ÌH±)Ì8
ÈJ)!j)ÞGot wifi started, but a port scan shows only the 23 open. It pings fine also.
espruino_1v96.21_esp32.bin
web-ide version 0.68.6Any hints?
I understand that a single call to digitalPulse may have better accuracy between pulses.. but as the application will fire a pulse after another sensor decodes a pattern. The setInterval came from the test code I added to simulate the hardware.
The question now is if the original espruino does better than the ESP32 port.