dvv / nodemcu-thingies

Assorted set of small Lua modules for nodemcu-firmware
57 stars 16 forks source link

lcd1602.lua:36: attempt to index a number value #3

Closed shredder2003 closed 8 years ago

shredder2003 commented 8 years ago

init.lua:

local busid = 0  -- I2C Bus ID. Always zero
local sda= 4     -- GPIO2 pin mapping is 4
local scl= 3     -- GPIO0 pin mapping is 3

i2c.setup(busid,sda,scl,i2c.SLOW)

lcd = dofile("lcd1602.lua")()
lcd.light(0)
lcd.locate(0,0)
lcd.put("Hello World!")

get error:


lcd1602.lua:36: attempt to index a number value
stack traceback:
    lcd1602.lua:36: in function 'light'
    init.lua:9: in main chunk
    [C]: in function 'dofile'
    stdin:1: in main chunk
>