{"guid":"9bacc4a3-ace3-55ae-b764-b6c3905b108f","title":"Pointless Blinking With Python, asyncio, and libgpiod (and a Raspberry Pi of Course)","subtitle":null,"slug":"glt23-322-pointless-blinking-with-python-asyncio-and-libgpiod-and-a-raspberry-pi-of-course-","link":"https://pretalx.linuxtage.at//glt23/talk/LKZYPX/","description":"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.","original_language":"eng","persons":["Jörg Faschingbauer"],"tags":["glt23","322","2023","Entwicklung","Graz","linuxtage","glt23"],"view_count":173,"promoted":false,"date":"2023-04-15T13:00:00.000+02:00","release_date":"2023-04-15T00:00:00.000+02:00","updated_at":"2026-03-14T19:15:05.317+01:00","length":2732,"duration":2732,"thumb_url":"https://static.media.ccc.de/media/events/glt/2023/322-9bacc4a3-ace3-55ae-b764-b6c3905b108f.jpg","poster_url":"https://static.media.ccc.de/media/events/glt/2023/322-9bacc4a3-ace3-55ae-b764-b6c3905b108f_preview.jpg","timeline_url":"https://static.media.ccc.de/media/events/glt/2023/322-9bacc4a3-ace3-55ae-b764-b6c3905b108f.timeline.jpg","thumbnails_url":"https://static.media.ccc.de/media/events/glt/2023/322-9bacc4a3-ace3-55ae-b764-b6c3905b108f.thumbnails.vtt","frontend_link":"https://media.ccc.de/v/glt23-322-pointless-blinking-with-python-asyncio-and-libgpiod-and-a-raspberry-pi-of-course-","url":"https://api.media.ccc.de/public/events/9bacc4a3-ace3-55ae-b764-b6c3905b108f","conference_title":"Grazer Linuxtage 2023","conference_url":"https://api.media.ccc.de/public/conferences/glt23","related":[],"recordings":[{"size":358,"length":2732,"mime_type":"video/webm","language":"eng","filename":"glt23-322-eng-Pointless_Blinking_With_Python_asyncio_and_libgpiod_and_a_Raspberry_Pi_of_Course_webm-hd.webm","state":"new","folder":"webm-hd","high_quality":true,"width":1920,"height":1080,"updated_at":"2023-04-17T12:42:39.450+02:00","recording_url":"https://cdn.media.ccc.de/events/glt23/webm-hd/glt23-322-eng-Pointless_Blinking_With_Python_asyncio_and_libgpiod_and_a_Raspberry_Pi_of_Course_webm-hd.webm","url":"https://api.media.ccc.de/public/recordings/66302","event_url":"https://api.media.ccc.de/public/events/9bacc4a3-ace3-55ae-b764-b6c3905b108f","conference_url":"https://api.media.ccc.de/public/conferences/glt23"},{"size":139,"length":2732,"mime_type":"video/webm","language":"eng","filename":"glt23-322-eng-Pointless_Blinking_With_Python_asyncio_and_libgpiod_and_a_Raspberry_Pi_of_Course_webm-sd.webm","state":"new","folder":"webm-sd","high_quality":false,"width":720,"height":576,"updated_at":"2023-04-16T16:31:31.595+02:00","recording_url":"https://cdn.media.ccc.de/events/glt23/webm-sd/glt23-322-eng-Pointless_Blinking_With_Python_asyncio_and_libgpiod_and_a_Raspberry_Pi_of_Course_webm-sd.webm","url":"https://api.media.ccc.de/public/recordings/66283","event_url":"https://api.media.ccc.de/public/events/9bacc4a3-ace3-55ae-b764-b6c3905b108f","conference_url":"https://api.media.ccc.de/public/conferences/glt23"},{"size":90,"length":2732,"mime_type":"video/mp4","language":"eng","filename":"glt23-322-eng-Pointless_Blinking_With_Python_asyncio_and_libgpiod_and_a_Raspberry_Pi_of_Course_sd.mp4","state":"new","folder":"h264-sd","high_quality":false,"width":720,"height":576,"updated_at":"2023-04-16T08:23:20.510+02:00","recording_url":"https://cdn.media.ccc.de/events/glt23/h264-sd/glt23-322-eng-Pointless_Blinking_With_Python_asyncio_and_libgpiod_and_a_Raspberry_Pi_of_Course_sd.mp4","url":"https://api.media.ccc.de/public/recordings/66247","event_url":"https://api.media.ccc.de/public/events/9bacc4a3-ace3-55ae-b764-b6c3905b108f","conference_url":"https://api.media.ccc.de/public/conferences/glt23"},{"size":41,"length":2725,"mime_type":"audio/mpeg","language":"eng","filename":"glt23-322-eng-Pointless_Blinking_With_Python_asyncio_and_libgpiod_and_a_Raspberry_Pi_of_Course_mp3.mp3","state":"new","folder":"mp3","high_quality":false,"width":0,"height":0,"updated_at":"2023-04-15T17:31:35.845+02:00","recording_url":"https://cdn.media.ccc.de/events/glt23/mp3/glt23-322-eng-Pointless_Blinking_With_Python_asyncio_and_libgpiod_and_a_Raspberry_Pi_of_Course_mp3.mp3","url":"https://api.media.ccc.de/public/recordings/66200","event_url":"https://api.media.ccc.de/public/events/9bacc4a3-ace3-55ae-b764-b6c3905b108f","conference_url":"https://api.media.ccc.de/public/conferences/glt23"},{"size":34,"length":2725,"mime_type":"audio/opus","language":"eng","filename":"glt23-322-eng-Pointless_Blinking_With_Python_asyncio_and_libgpiod_and_a_Raspberry_Pi_of_Course_opus.opus","state":"new","folder":"opus","high_quality":false,"width":0,"height":0,"updated_at":"2023-04-15T17:30:27.248+02:00","recording_url":"https://cdn.media.ccc.de/events/glt23/opus/glt23-322-eng-Pointless_Blinking_With_Python_asyncio_and_libgpiod_and_a_Raspberry_Pi_of_Course_opus.opus","url":"https://api.media.ccc.de/public/recordings/66197","event_url":"https://api.media.ccc.de/public/events/9bacc4a3-ace3-55ae-b764-b6c3905b108f","conference_url":"https://api.media.ccc.de/public/conferences/glt23"},{"size":261,"length":2732,"mime_type":"video/mp4","language":"eng","filename":"glt23-322-eng-Pointless_Blinking_With_Python_asyncio_and_libgpiod_and_a_Raspberry_Pi_of_Course_hd.mp4","state":"new","folder":"h264-hd","high_quality":true,"width":1920,"height":1080,"updated_at":"2023-04-15T14:47:38.433+02:00","recording_url":"https://cdn.media.ccc.de/events/glt23/h264-hd/glt23-322-eng-Pointless_Blinking_With_Python_asyncio_and_libgpiod_and_a_Raspberry_Pi_of_Course_hd.mp4","url":"https://api.media.ccc.de/public/recordings/66164","event_url":"https://api.media.ccc.de/public/events/9bacc4a3-ace3-55ae-b764-b6c3905b108f","conference_url":"https://api.media.ccc.de/public/conferences/glt23"}]}