Pointless Blinking With Python, asyncio, and libgpiod (and a Raspberry Pi of Course) (glt23)

Published: April 15, 2023, 11 a.m.

b'One of my more pointless projects is to blink a configurable set of\\nprogrammable patterns on a number of LEDs. This might sound like "hey,\\nyou are reinventing the wheel". I admit I do - I am a notorious\\nreinventer, and it is fun.\\n\\n* [Livehacking screenplay](https://www.faschingbauer.me/about/site/work-in-progress/blink/screenplay.html)\\n* [Proposal text](https://www.faschingbauer.me/about/site/work-in-progress/blink/glt.html)\\n* [Installation notes](https://www.faschingbauer.me/about/site/work-in-progress/blink/installation.html)\\n\\nLets reinvent LED blinking in a live-hacking session, and look into a\\nnumber of topics as we go:\\n\\n* Python is a programming language that most of you know. It is simple\\n and expressive, thus *fun*.\\n* Python\'s ``asyncio`` is a parallel programming technique, similar to\\n multithreading in its usage, but fundamentally different in every\\n other respect. At its core, it maps multiple parallel control flows\\n onto one *single-threaded* event loop. Given that timers are events,\\n this gives us the possiblity to run multiple LED blinking programs\\n in one single thread - saving all the context switching and\\n scheduling overhead that multithreaded programs usually\\n exhibit. Blinking with less glitches caused by context switch hiccups!\\n* Ah, blinking patterns. Know what Python decorators are? Closures?\\n We\'ll twist our brains and create a ``@program`` decorator,\\n implemented as a double-closure, and use that to write a number of\\n amazingly simple blinking programs. Almost like functional\\n programming.\\n* Last not least, ``libgpiod``. The way to go for GPIO on Linux.\\nabout this event: https://pretalx.linuxtage.at//glt23/talk/LKZYPX/'