source

pico_ada_c04_pwm

1.7.0

Chapter 4: Analog LED with PWM

1.7.0

Building smooth breathing LEDs and flowing light bars with hardware PWM on the Raspberry Pi Pico using Ada. From jittery duty cycles to perfect linear dimming - guided by the Voltcraft MSO-5102B oscilloscope and a deep dive into PWM slice mapping on both Pico 1 and Pico 2.

In this chapter we create a reusable Pico.Analog package for PWM-based analogue output. We start with a classic breathing light, then move on to a flowing light bar. Along the way the MSO-5102B reveals the real behaviour of our code, and we discover (and fix) a subtle bug in the experimental RP2350 HAL.

Contained in Chapter 04 are:

  1. Pwm - Original PWM sample from Jeremy Grosser
  2. sketch_04_1_breathing_light - Chapter 4.1 Blink internal LED
  3. sketch_04_2_flowing_light_2 - Chapter 4.1 Project Meteor Flowing Light

Read the full tutorial at Chapter 4: Analog & PWM, GNATdoc documentation, SourceForge repository