-
• #2
Honestly, I'd ignore the hardware SPI, and go straight for software - then you can use whatever pins you want:
var s = new SPI(); s.setup({ sck:NodeMCU.D8, mosi:NodeMCU.D7 }); var g = require("PCD8544").connect(s, ...);
-
• #3
Thanks. I have that a go - however still a blank screen. I'm unsure in the nodemcu board the upper tx and rd are D8 and D9.
I might have to pull the one wire and led stuff I have on lower pins and try that next.
-
• #4
Hm, I remember having problems using software SPI - nothing seemed to work, but I didn't have the scope on hand to figure out what was going on.
What's wrong with using hardware SPI?
-
• #5
Hardware SPI on ESP8266 is a huge copy/paste hack that ignores all the pin assignments, and sets up all the SPI registers and blocks for every single byte sent. As a result you might feel better, but realistically it's actually going to be less efficient than just using software.
Software really should work - I guess a while back there were issues with the internal
pinMode
calls not working sometimes (due topinStateIsManual
not being reset) that might have tripped you up, but that's been fixed for ages. -
• #6
I've had it working. This is the code I used for a Nokia 5110 aka the PCD8544
SPI1.setup({ sck:NodeMCU.D5, mosi:NodeMCU.D7 }); var g = require("PCD8544").connect(SPI1, NodeMCU.D2 /* RS / DC */, NodeMCU.D8 /* CS / CE */, NodeMCU.D1 /*RST*/, function() { g.clear(); g.setRotation(2); //Flip display 180 g.drawString("Hello",0,0); g.drawLine(0,10,84,10); g.flip(); });
Display NodeMCU ESP-12 LED 3V3 3V3 SCLCK D5 GPIO14 DN<MOSI> D7 GPIO13 D/C D2 GPIO04 RST D1 GPIO05 SCE D8 GPIO15 GND GND GND VCC 3V3 3V3
-
• #7
I've also had it working with an I2C OLED, the SSD1306, here's that code:
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, draw);
Display NodeMCU ESP-12 SCL D4 GPIO2 SDA D3 GPIO0 GND GND GND VCC 3V3 3V3
These should probably be put on some wiki somewhere.
-
• #10
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?
-
• #11
Your firmware version is out of date and does not have the graphics module built it. Update the firmware.
-
• #12
I can't upload new firmware by
./wiflash 192.168.1.9 espruino_esp8266_user1.bin espruino_esp8266_user2.bin
I've got terminal error
Error retrieving http://192.168.1.9/flash/next
-
• #13
it needs the port:
./wiflash 192.168.1.9:88 espruino_esp8266_user1.bin espruino_esp8266_user2.bin
-
• #14
thank you @Wilberforce it works on esp-12E,
but can't run it on NodeMCU Lolin -
• #15
For the wiflash to work - the device has to be connected to the network and will have it's own ip address. Did you check the address the Lolin was getting?
You could try using the serial flash.
-
• #16
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
-
• #17
What is the output of
process.env
andprocess.memory()
-
• #18
@bigplik You need the latest binaries with Graphics support in them. Download the latest release and use wiflash to flash them to the ESP8266.
Just to add, if you're on Windows I believe if you install Git, and select "Use Git and optional Unix tools from the windows command prompt", you can run wiflash (Inside the download zip in the ESP8266 Folder) on windows with "sh wiflash" instead of "./wiflash" just remember to change the IP but keep the port number (":88"). Would be awesome if that was added to the docs page.
-
• #19
The docs are here if you want to do some tweaks ;)
https://github.com/espruino/EspruinoDocs/blob/master/boards/EspruinoESP8266.md
-
• #20
Will do. Shouldn't wiflash be renamed to wiflash.sh? Also, I just want to double check that "sh" does the same thing as "./" on Linux.
-
• #22
Sweet, I'll do a pull request to update the Docs in preparation
-
• #23
Is this only applicable to ESP-12 ? Because i try connect I2C SSD1306 on ESP-01 (1MB version, Espruino v1.91), console show error: "Graphics" is not defined.
-
• #25
Hi @user72844
check this build and follow the instruction in README_flash.txt to flash your ESP with this build.
Has anyone managed to use the esp8266 to drive a graphics display?
I'm confused on how the
nodemcu.D?
pin outs correspond to the sp1 labeled on the board, and which pins are free to use - I know that nodemcu.D4 is the serial debug, so pins D5 upwards are ok, but unsure on how these map.A fritzing diagram or similar would be appreciated!
So far I have:
Thanks