-
@allObjects could you drop some link about it?
-
-
@allObjects yes this is what I am looking for
-
-
hi @MaBe I use Pico this time
-
hi, I want to write code for analogReads sampling, in C i use for loop, I want to make let say 50-100 reads before I print them to console or to display, then can make analogRead a bit more precise as the readings floats a bit when use just simple analogRead function and timer Interval,
I appreciate some advice in this case -
I still have same error in console, even after sucessful firmware upgrade by ./wiflash
Uncaught ReferenceError: "Graphics" is not defined at line 1 col 20 k(c);var g=Graphics.createArrayBuffer(128,f[4]+1,1,{vertical... ^ in function "connect" called from line 1 col 40 var g = require("SSD1306").connect(I2C1); ^ =undefined
I've been trying to upload this code
pinMode(NodeMCU.D3,'input_pullup'); pinMode(NodeMCU.D4,'input_pullup'); function draw(){ g.clear(); g.drawString("Hello World",0,0); g.flip(); } I2C1.setup({scl:NodeMCU.D4,sda:NodeMCU.D3}); var g = require("SSD1306").connect(I2C1);
I deal with another NodeMcu, before I tried with Lolin board and now with CP2101 chip, but still can't connect OLED
-
thank you @Wilberforce it works on esp-12E,
but can't run it on NodeMCU Lolin -
hi, had anyone some issue with nodeMcu Lolin with CH340G to make it work generally on mac?
when I plug it into usb port it will restart my mac,
however on PC it is working eg. with arduinoIDE,
in Espruino case, when I use PC it flash code for Espruino firmware for ESP8266 but wifi upload not work, not sure what's wrong because when I connect another no nodeMcu Esp8266-12E board it works fine, I can flash Espruino firmaware by usb and upload code by wifi,
it could be problem whith this board? (this board works with OTA arduino) -
-
i have that error in console when use last @Ducky code
Uncaught ReferenceError: "Graphics" is not defined at line 1 col 20 k(c);var g=Graphics.createArrayBuffer(128,f[4]+1,1,{vertical... ^ in function "connect" called from line 1 col 40 var g = require("SSD1306").connect(I2C1); ^ =undefined
how can I fix it?
-
-
@DrAzzy ,what is the proper code form to stop interval that way you said?
I triedclearInterval(){1}
and it works when I typed it into console,
but when I placed that form into my code into if statement
WebIDE shows errors,
I used then clearInterval(1); instead but it isn't work -
found another issue,
if I want to just read analog values there clearInterval is ok, but if I want to measure something continuously, like time, stopwatch etc. then every time I swap between my screens I clear interval and will stop time or stopwatch which I don't want,
any solution?
or maybe there is some already written stopwatch code here? -
yes, I found it myself Gordon ;) just wanted to post I found solution ;)
my code looks now that, and is working now ;)function OLED(){ clearWatch(); I2C1.setup({scl:B6,sda:B7}); var g = require("SSD1306").connect(I2C1); g.clear(); g.flip(); pinMode(B15, 'input_pulldown'); //Button tests var BTN22 = B15; var screen = 0; var battery; // = analogRead(A5)*2*3.3; var analogSample; function screens(){ g.clear(); g.setFontVector(15); g.drawString("one",25,20); g.flip(); } function screens2(){ analogSample = analogRead(A2); g.clear(); g.setFontVector(15); g.drawString("OLED OFF?"); g.setFontVector(10); g.drawString(analogSample,60,50); g.flip(); } function screens3(){ battery = analogRead(A5); g.clear(); g.setFontVector(20); g.drawString("" + battery.toFixed(2),20,20); g.flip(); } setWatch(function(e) { screen++; console.log(screen); clearInterval(); if(screen === 0) screens(); if(screen === 1) setInterval(screens2,200); if(screen === 2) setInterval(screens3,500); if(screen >= 2) screen = 0; },BTN22, {repeat: true, edge: 'rising', debounce:150}); } OLED();
-
-
Could anyone help to solve an issue with my code?
I have 3 screens, first screen "one" on the beginning, then second screen "OLED OFF?" and third "analogRead(A5)"
until I change screens by button (setWatch) and have no intervals set then it works really well, no lags, but when I want to update this analogRead(A5) informations every 500ms then I noticed that I can't switch to the other screen just by one push of the button, sometimes I need several or dozen push to do it, when I don't use intervals it works again,
what should I change to be able to have few screens where I can watch on different analog values updated every 500-1000ms?function OLED(){ clearWatch(); I2C1.setup({scl:B6,sda:B7}); var g = require("SSD1306").connect(I2C1); g.clear(); g.flip(); pinMode(B14, 'input_pulldown'); var BTN22 = B15; var screen = 0; var battery = analogRead(A5)*2*3.3; function screens(){ g.clear(); g.setFontVector(15); g.drawString("one",25,20); g.flip(); } function screens2(){ g.clear(); g.setFontVector(15); g.drawString("OLED OFF?");g.flip(); } function screens3(){ battery = analogRead(A5); g.clear(); g.setFontVector(20); g.drawString("" + battery.toFixed(2),20,20); g.flip(); } setWatch(function(e) { clearInterval(); screen++; console.log(screen); if(screen === 0) screens(); if(screen === 1) screens2(); if(screen === 2) screens3();setIterval(screens3,500); if(screen >= 2) screen = 0; },BTN22, {repeat: true, edge: 'rising', debounce:150}); OLED();
-
@MaBe I see that dots sometimes, usually on the beginning, when I upload new code first, then when I upload it again I see on the display what I wanted,
and also when I wake up the display I see something like a flash with dots in some parts of the display for a short time, and after details I wanted, I use graphic library from Espruino example http://www.espruino.com/Graphics
Could it be something with unstable current? wiring? what you think? -
-
this is the code
function i2c1(c){I2C1.writeTo(0x3C, [0,c]);} function dispoff(){i2c1(0xae);} function dispon(){i2c1(0xaf);} function OLED(){ pinMode(A7,'output'); digitalWrite(A7,1); I2C1.setup({scl:B6,sda:B7}); var g = require("SSD1306").connect(I2C1); g.clear(); g.flip(); g.setFontVector(15); g.drawString("OLED",25,20); g.flip(); } OLED();
but this only change the position of string displayed on the OLED,
when I type 'i2c1(dispoff)' or 'i2c1(dispon)' -
-
-
it just prints 'screen' value in console,
values are from 0 up to 2,
those values correspond to details I see on the OLED display (from functions screens(), screens2() and screens3()If (screen === 2) and I press BTN11 then my OLED is switched off by disconnecting the VCC line, when I press BTN11 again VCC line is again connected into display and OLED() function starts. The same time I have console.log with value of 'screen'.
When I do this sequence (screen ===2) and BTN11 press again, every time I see more console.logs in WebIDE console window, and program start to slow down, wait for all logs and then react for my button presses, after a while it stock -
This is the code I use when Espruino stop working.
There is some error as console log after first "wake up" print console value twice, then every next wake up it increase the number of console.log printsfunction OLED(){ pinMode(A7,'output'); //A7 Mosfet Gate PIN for OLED digitalWrite(A7,1); I2C1.setup({scl:B6,sda:B7}); var g = require("SSD1306").connect(I2C1); g.clear(); g.flip(); pinMode(B14, 'input_pulldown'); pinMode(B15, 'input_pulldown'); //variables var BTN22 = B15; var BTN11 = B14; var screen = 0; var battery = analogRead(A0)*2*3.3; var i = true; function screens(){ g.clear(); g.setFontVector(15); g.drawString("MOTOR ON",20,20);g.flip(); } function screens2(){ g.clear(); g.setFontVector(15); g.drawString("OLED OFF?");g.flip(); } function screens3(){ g.clear(); g.setFontVector(20); g.drawString("" + battery.toFixed(2)); g.flip(); } setWatch(function(e) { if(screen === 0) screens(); if(screen === 1) screens2(); if(screen === 2) screens3(); screen++; console.log(screen); if(screen > 2) screen = 0; },BTN22, {repeat: true, edge: 'rising', debounce:150}); setWatch(function(e) { i = !i; if(screen === 0) OLED(); if(screen === 2) digitalWrite(A7,i); screen =0; console.log(screen); },BTN11, {repeat: true, edge: 'rising', debounce:150}); screens(); } OLED();
about reset
do you mean about this pin?
thank you