Post your best Lua script examples here

User avatar
By devsaurus
#12439 It appears to work fine for me. I use ESPlorer for upload:

Code: Select all> for n,s in pairs(file.list()) do print(n.." size: "..s) end
u8g_rotation.lua size: 2052
u8g_rook.bm size: 9
u8glib_logo.xbm size: 121
> =node.heap()
21480
> dofile("u8g_rotation.lua")
--- Starting Rotation Test ---
--- Rotation Test done ---
> =node.heap()
13992
> =disp
userdata: 0x3fff71a0


A nil in disp should only happen if the display can't be initialized. Eg if a pin is missing in the parameter list for ssd1306_128x64_spi or no I2C address is given to ssd1306_128x64_i2c
User avatar
By pracas
#13342 Doesn't work for me... getting the same error. Using ESPlorer to upload.

@devsaurus did you compile nodemcu or did you using an existing build?
User avatar
By Trilex
#13711 You need to choose your interface at the end of the file (set the "--" (comment) befor the function, you dont need). The example use the spi interface as standard.:

Code: Select all--init_i2c_display()
init_spi_display()
rotation_test()


Select the right pins at the init_***_display() function at start. The numbers are not the Pin numbers. have a look at this table :
https://github.com/nodemcu/nodemcu-firmware#gpio-new-table--build-20141219-and-later