-
-
Save MaBecker/4c29a1d56a922dc01a23f7b4e1326b7c to your computer and use it in GitHub Desktop.
Espruinino: Test module SH1106 on ESP8266
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// oled_sh1106.js | |
SDA = D5; | |
SCL = D4; | |
var esp = require('ESP8266'); | |
esp.logDebug(false); | |
esp.setLog(0); | |
var g; | |
function draw() { | |
g.setFontVector(25); | |
g.drawString("Espruino",0,0); | |
g.drawString("Rocks!",0,32); | |
g.flip(); | |
} | |
function onInit(){ | |
I2C1.setup({sda:SDA,scl:SCL, bitrate:4000000}); | |
// no optimization and module uploaded as function | |
g = require("SH1106").connect(I2C1, draw); | |
// use module from flash | |
//g = require("SH1106S").connect(I2C1, function(){}); | |
} | |
setTimeout(save,1E3); | |
/* | |
* no optimization | |
process.memory(); | |
={ free: 1267, usage: 333, total: 1600, history: 170, | |
gc: 0, gctime: 1.862 } | |
* module uploaded as function | |
process.memory() | |
={ free: 1265, usage: 335, total: 1600, history: 170, | |
gc: 0, gctime: 1.862 } | |
* use module from flash | |
>process.memory() | |
={ free: 1357, usage: 243, total: 1600, history: 60, | |
gc: 0, gctime: 1.874 } | |
* freeHeap is for all cases 11736 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment