|
|
(8 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) |
Zeile 1: |
Zeile 1: |
| [[Kategorie:öffentlich]] | | [[Kategorie:öffentlich]] |
| {{aktives Projekt|Kontakt=Berkay|öffentlich=ja}} | | {{aktives Projekt|Kontakt=Berkay|öffentlich=ja}} |
| Hier wird der bisherige Projektcode von dem Projekt Light Cube reingestellt. Die Projektseite: [[Light_Cube]]
| | Wenn du Fragen zum Projektcode hast, wende dich an [[Benutzer:Berkay|Berkay]] |
| | |
| | |
| '''ESP-Platine/Bauteil ESP NodeMCU Devboard'''
| |
| ----
| |
| Verbindung mit dem WLAN herstellen:
| |
| wifi.setmode(wifi.STATION)
| |
| wifi.sta.config("SSID", "PW")
| |
| wifi.setmode(wifi.STATION)
| |
| wifi.sta.config("C3MA", "chaosimquadrat")
| |
| ws2812.init();
| |
| local ledCount = 34;
| |
| local leds = string.char(10,00,0):rep(ledCount)
| |
| local tick = false;
| |
| function readjson(data)
| |
| ok, json = pcall(cjson.decode, data)
| |
| if ok then
| |
| leds = ""
| |
| for ledid = 1, ledCount, 1 do
| |
| local ledData = json[ledid];
| |
| leds = leds .. string.char(ledData.g,ledData.r,ledData.b)
| |
| end
| |
| else
| |
| print("failed to decode!")
| |
| end
| |
| end
| |
| local pseudoRemote = {}
| |
| for ledid = 1, ledCount, 1 do
| |
| pseudoRemote[ledid]={}
| |
| pseudoRemote[ledid].r=100
| |
| pseudoRemote[ledid].g=0
| |
| pseudoRemote[ledid].b=ledid
| |
| end
| |
| local remoteData = cjson.encode(pseudoRemote);
| |
| print(remoteData)
| |
| local srv=net.createServer(net.TCP)
| |
| srv:listen(80,function(conn)
| |
| conn:on("receive",function(conn,payload)
| |
| print("Got something...")
| |
| print(payload);
| |
| readjson(payload)
| |
| conn:send("HTTP/1.1 200 OK\n")
| |
| conn:send("Content-Type: text/html\n\n")
| |
| end)
| |
| end)
| |
| function update ()
| |
| if(not wifi.sta.getip())then
| |
| tick = not tick;
| |
| if(tick)then
| |
| ws2812.write(string.char(0,0,20):rep(ledCount))
| |
| else
| |
| ws2812.write(string.char(0,0,0):rep(ledCount))
| |
| end
| |
| return;
| |
| end
| |
| ws2812.write(leds)
| |
| end
| |
| tmr.alarm(0, 100, tmr.ALARM_AUTO, update)
| |
| | |
| | |
| '''Hauptsteuereinheit'''
| |
| ----
| |
| --
| |
Dies ist ein Projekt, an dem momentan aktiv gearbeitet wird. Wenn du Fragen hast oder mitarbeiten möchtest, wende dich an
Berkay.
Wenn du Fragen zum Projektcode hast, wende dich an Berkay