Compare commits

..

No commits in common. "b47db0f6d9715dd3ca26ed7382d9105e9c0bdc54" and "f929cabd4e4d870ca452bc35d56d7baacf2f1efd" have entirely different histories.

3 changed files with 0 additions and 84 deletions

View file

@ -1 +0,0 @@
dofile("main.lua")

View file

@ -1,10 +0,0 @@
dofile("screen.lua")
-- connecte l'écran sur les pins 18 et 19
attachscreen(18, 19, 0x3C)
-- connecte la bande de led sur le pin 21
neo = neopixel.attach(neopixel.WS2812B, pio.GPIO21, 8)
cls()
console("test")

View file

@ -1,73 +0,0 @@
function attachscreen(sda, scl, i2cadd)
try (
function ()
i2c.setpins(0,sda,scl)
gdisplay.attach(gdisplay.SSD1306_128_64, gdisplay.LANDSCAPE, false, i2cadd)
gdisplay.clear()
gdisplay.setfont(gdisplay.FONT_LCD)
gdisplay.setwrap(false)
end,
function (where, line, error, message)
print("Couldn't attach the screen.\nError in "..where.." at "..line.." "..error..": "..message)
end,
function () end
)
end
local consolepos = 0
local consoletab = {}
local consolemax = 6
local oledflip = 1
function flip()
oledflip = oledflip+1; if oledflip > 3 then oledflip = 0 end
if oledflip==0 then
consolemax = 6
gdisplay.attach(gdisplay.SSD1306_128_64, gdisplay.LANDSCAPE_FLIP, false, i2cadd)
elseif oledflip==1 then
consolemax = 6
gdisplay.attach(gdisplay.SSD1306_128_64, gdisplay.LANDSCAPE, false, i2cadd)
elseif oledflip==2 then
consolemax = 13
gdisplay.attach(gdisplay.SSD1306_128_64, gdisplay.PORTRAIT, false, i2cadd)
else
consolemax = 13
gdisplay.attach(gdisplay.SSD1306_128_64, gdisplay.PORTRAIT_FLIP, false, i2cadd)
end
cls()
end
function cls()
if (consolemax==6) then gdisplay.clear()
else
gdisplay.rect( {0,0}, 128, 9*consolemax, {0,0,0}, {0,0,0} )
end
if oledflip ~= 1 then gdisplay.clear() end
consolepos = 0
consoletab={}
for i=0, consolemax do
consoletab[i] = ""
end
end
function console(msg)
if (consolepos <= consolemax) then
consoletab[consolepos] = msg
gdisplay.write({0, consolepos*9},msg)
consolepos = consolepos+1
else
for i = 1, consolemax do
consoletab[i-1] = consoletab[i]
end
consoletab[consolemax] = msg
if (consolemax==6) then gdisplay.clear()
else
gdisplay.rect( {0,0}, 128, 9*consolemax+9, {0,0,0}, {0,0,0} )
end
for i=0, consolemax do
gdisplay.write({0, i*9},consoletab[i])
end
end
end