-
-
-
I don't know exactly how big my final code will be, but I solved the html processing (including the UTF-8 problem) by reading my html code directly from an sd card. Interestingly, the handling of the SH1106 oled (128x64) is handled very well by Espruino compared to e.g. the Raspberry Pi Pico micropython environment (but maybe I was the only one who was lame).
Question to the software developers, is there a Raspberry Pi Pico version of the interpreter in the pipeline? -
-
-
-
you maybe right. it occurred to me that perhaps the character encoding of the operating system could also cause this error. utf-8 character encoding seems good, but it is actually saved incorrectly in the source code. under windows, you can set the BOM in the text editor, which, if I know it, saves the block needed for utf-8/16 encoding in the given text file. this option i cant find for ubuntu gedit.
https://www.w3.org/International/questions/qa-byte-order-mark
-
-
-
-
I use sd card interface board with 3.3V and I2C SH 1106 oled display (also 3.3V).
I measured the current consumption of the test panel with a usb Keweisi ammeter and the current was between 0.05A and 0.1A.
Seems to be temperature was higest (50, 51 C) when javascript code send socket message and received bit-serial from wiegand reader via optocoupler isolation. Simultanosly ran two pin interrupt, socket server and a setintervall function with temperature sending via socket message. -
Hi Robin,
Here is the javascript code with html variable and webserver function.html = ` <!doctype html> <head> <meta charset="UTF-8"> <style> html {font: 20px monospace} body { color: #333; text-align: center; padding: 150px; } h1 { font-size: 50px; } article { display: block; text-align: left; width: 650px; margin: 0 auto; } a { color: [#dc8100](https://forum.espruino.com/search/?q=%23dc8100); text-decoration: none; } a:hover { color: #333; text-decoration: none; } select {font: 20px monospace;padding: 4px;} </style> <script> window.onload = () => { var ws = new WebSocket('ws://' + location.host, 'protocolOne'); var temp = document.getElementById('temp'); var wieg1 = document.getElementById('wieg1'); var oled = document.getElementById('oled'); ws.onmessage = evt => { var d = JSON.parse(evt.data); switch(d.param) { case 'temp': temp.innerText = d.value; break; case 'wieg1': wieg1.innerText = d.value; break; } }; oled.onchange = evt => { ws.send(oled.value); }; }; </script> </head> <body> <h1>Sorompó vezérlő</h1> <p>Alaplap hőmérséklete: <span id="temp">0</span> ℃</p> <p>Wiegand olvasó 1 csatorna: <span id="wieg1"></span></p> <p>Wiegand olvasó 2 csatorna: <span id="wieg2"></span></p> <p> LED on: <select id="oled"> <option>off</option> <option>on</option> </select> </p> </body> </html>`; function startServer( ) { const s = require('ws').createServer(pgHandler); s.on('websocket', wsHandler); s.listen( 80 ); } function pgHandler(req, res) { res.writeHead(200, { 'Content-Type':'text/html' }); res.end(html); }
Chrome received html code
<!doctype html> <head> <meta charset="UTF-8"> <style> html {font: 20px monospace} body { color: #333; text-align: center; padding: 150px; } h1 { font-size: 50px; } article { display: block; text-align: left; width: 650px; margin: 0 auto; } a { color: [#dc8100](https://forum.espruino.com/search/?q=%23dc8100); text-decoration: none; } a:hover { color: #333; text-decoration: none; } select {font: 20px monospace;padding: 4px;} </style> <script> window.onload = () => { var ws = new WebSocket('ws://' + location.host, 'protocolOne'); var temp = document.getElementById('temp'); var wieg1 = document.getElementById('wieg1'); var oled = document.getElementById('oled'); ws.onmessage = evt => { var d = JSON.parse(evt.data); switch(d.param) { case 'temp': temp.innerText = d.value; break; case 'wieg1': wieg1.innerText = d.value; break; } }; oled.onchange = evt => { ws.send(oled.value); }; }; </script> </head> <body> <h1>Soromp� vez�rlő</h1> <p>Alaplap hőm�rs�klete: <span id="temp">0</span> ℃</p> <p>Wiegand olvas� 1 csatorna: <span id="wieg1"></span></p> <p>Wiegand olvas� 2 csatorna: <span id="wieg2"></span></p> <p> LED on: <select id="oled"> <option>off</option> <option>on</option> </select> </p> </body> </html>
-
Hi,
First of all I would be like to say a big thank for your products.
Amazing devices with my favorite programming language :)
I build a smart barrier controller, controlling barrier and managering proxy cards via socket connection controlled by android phone.
My problems is UTF-8 character encoding (hungarian's accented characters) and representating. As you can see on attached images the accented characters are well in the Espruino memory but they appear bad on browser. Interestingly, e.x. the "ő" character also appear well in the browser and in the code, but other chars appear as question mark. How can it be?
HTML codehtml = ` <!doctype html> <head> <meta charset="UTF-8"> ..... <body> <h1>Sorompó vezérlő</h1> <p>Alaplap hőmérséklete: <span id="temp">0</span> ℃</p> <p>Wiegand olvasó 1 csatorna: <span id="wieg1"></span></p> <p>Wiegand olvasó 2 csatorna: <span id="wieg2"></span></p> <p> LED on: <select id="oled"> <option>off</option> <option>on</option> </select> </p> </body> </html>`;
My other question is, is the operating temperature of the Espruino wifi CPU normal as shown in the attached picture, or does the motherboard require cooling?
Thank you for your helping hand.
Laci
Thank you Gordon :)