Hello everyone,
I have just published Chapter 6: NeoPixel of the Raspberry Pi Pico Ada Tutorial.
In this chapter I go beyond the usual “just use the library” approach and explain how the WS2812 protocol actually works and why the RP2040’s PIO is perfect for it. You will see:
- A simple square-wave generator used as a learning and debugging tool
- The four gotchas that had me staring at the oscilloscope for far too long
- A corrected and fully commented version of Jeremy Grosser’s ws2812_demo
- Two complete animation sketches (Sketch_06_1_LED_Pixel and Sketch_06_2_Rainbow_Light)
The chapter also contains a practical introduction to PIO programming and shows how to generate Ada code automatically with the official pioasm tool.
New GNATdoc documentation is available for both Pico and Pico 2:
- https://pi-ada-tutorial.sourceforge.io/gnatdoc/pico_ada_doc/
- https://pi-ada-tutorial.sourceforge.io/gnatdoc/pico2_ada_doc/
Don’t forget the Side Quests either — they cover system setup, Alire, Visual Studio Code, hardware debugging, adding a reset button, and more.
As always, the full source code is on SourceForge and available as an Alire crate (in a few days).
Feedback and questions are very welcome!
Happy hacking, Martin