ph1p / ikea-led-obegraensad

ESP32/Arduino hack for the ikea OBEGRÄNSAD led wall lamp
MIT License
610 stars 85 forks source link

tixy.land inspired mode [enhancement] #38

Open juliendorra opened 1 year ago

juliendorra commented 1 year ago

A new creative coding mode inspired by tixy.land

Context tixy (https://tixy.land/) is a very simple creative coding playground. Users can write a short formula using the time, index, x and y parameters, and the formula is evaluated and returned for each dot, and values are capped between -1 and 1. 0 to 1 means a white dot. 0 to -1 a red dot, with 1/-1 the max size and 0 no dot.

More infos there: https://twitter.com/aemkei/status/1323399877611708416

The code is simple enough and easy to ready: https://github.com/aemkei/tixy/

Limitation We of course drop the color (negative values) dots. Using persistence of vision and a fast refresh rate could help turning the dot size value into LED intensity values.

Adaptation We could store and compute the formula on the micro-controller (using https://github.com/owenmcateer/tixy.land-display and https://github.com/codeplea/tinyexpr for example)

But much probably the easiest way to get a working version with reasonable effort is reuse and adapt the web front of tixy.land:

Plus: The preview and interpreter is already there, and the receiving code on the micro-controller can be simpler, focusing on driving the LEDs. All the existing tixy formulas shared on twitter and elsewhere can be tried.

Minus: There’s nor code to persist on the micro-controller, and thus once we close our browser the screen stops displaying our tixy formula results. We needs a browser to control and send the value, all the creative coding part is actually done in the browser, which may limit the hacking aspect / fun? The micro-controller needs to store and serve the tixy page and code.

juliendorra commented 1 year ago

First version of tixy for obgraensad led https://github.com/juliendorra/ikea-led-obegraensad/tree/tixy

https://github.com/ph1p/ikea-led-obegraensad/assets/109677/75cddb50-f83b-4453-b6c1-c1705f10ded7

Demo at refresh period of 3s (lower crash the ESP, see below)

https://github.com/ph1p/ikea-led-obegraensad/assets/109677/e31dbb82-2e60-42f7-a5c2-a6b05c958970

This branch replace the whole front end with a single tixy page. Only the js file is modified compared to the official tixy.land site.

The web page then use the seb socket to send screen events with the whole screen.

At the moment the bottleneck is apparently the ESPAsyncWebServer server that cannot receive the data fast enough and crash.