-
function i2c1(c){I2C1.writeTo(0x3C, [0,c]);} function dispoff(){i2c1(0xae);} function dispon(){i2c1(0xaf);} i2c1(dispoff)
What do you expect that to do? Probably not what it's doing.
You create a function called
i2c1
which takes an argument, and sends that to the display.You also create a function called
dispoff
which calls that first function with the appropriate argument to turn off the display.But when you do
i2c1(dispoff)
you're telling it to send the function dispoff to the display (I have no idea what Espruino actually sends here, but I guarantee it's not what you want).Instead, you want to just call dispoff, eg
dispoff();
(which is pretty much what MaBe has posted)
this is the code
but this only change the position of string displayed on the OLED,
when I type 'i2c1(dispoff)' or 'i2c1(dispon)'