From first blink to heartbeat
The setup. I started with a fresh Raspberry Pi, Python installed, and a breadboard wired up with an LED, a resistor, and some jumper wires. This was my first time writing code that controls real hardware, and I built it with ChatGPT helping me along.
First blink. LED on, LED off, LED on again – the “hello world” of hardware. It’s a small thing, but getting that single blinking light working meant the circuit was wired correctly and the Pi was actually talking to GPIO. (*´◡`*)
Buttons and pulse modes. From there I snapped tactile buttons onto the breadboard and wrote input detection using the GPIO library (with edge detection), where each button triggers a different heartbeat mode. I also switched the LED from basic on/off to PWM for smooth fading, and added a charge-up transition between modes that ramps brightness up and down over a couple of seconds.
It works! Then immediately… it could be better. I got the full heartbeat logic running with normal pulse and double/fast pulse modes both firing on the real LED. I hit a “name is not defined” bug in the while True loop (turned out to be a scope issue with a missing variable), and after fixing it and celebrating, I immediately noticed that the normal and double beats didn’t feel different enough, so I started tuning the timing.
Quest complete. I slowed the normal heartbeat way down so it’s a proper “doof doof doof doof” now, and extended the fast-beat continuation after charge-up. The normal and double modes finally feel distinct from each other, and the buttons trigger different modes cleanly, and the LED genuinely feels alive. (*´◡`*)