#149
Raspberry Pi Pico Alternating Two LEDs (Blink-Flip Pattern, GP14 + GP13)
The next step after single LED on Pico: two LEDs blink alternately in a classic flip-flop pattern. When one turns off, the other lights up — the most basic example of multi-GPIO coordination. In this project two different color LEDs (red on GP14, green on GP13) swap states every 500ms. MicroPython's `Pin.toggle()` method makes the code short and clear. The same core logic is the foundation of traffic lights, police strobes, chasing LEDs and all multi-LED animations. Very simple circuit: 220Ω res
0.0(0)

The next step after single LED on Pico: two LEDs blink alternately in a classic flip-flop pattern. When one turns off, the other lights up — the most basic example of multi-GPIO coordination. In this project two different color LEDs (red on GP14, green on GP13) swap states every 500ms. MicroPython's `Pin.toggle()` method makes the code short and clear. Very simple circuit: 220Ω resistor + Pico GPIO + GND per LED.
Video
Circuit Diagram

Source Code
1# ─────────────────────────────────────────
2# BlueGrays · bluegrays.com
3# Pico 2 LED Alternatif Yakma (GP14 + GP13)
4# ─────────────────────────────────────────
5# TR: 2 LED'i sirayla yakip sondurerek klasik 'flip-flop' animasyonu
6# EN: Two LEDs blink alternately in a flip-flop pattern
7
8from machine import Pin
9from time import sleep
10
11# ============ PIN / PIN ============
12led1 = Pin(14, Pin.OUT) # TR: Kirmizi LED | EN: Red LED
13led2 = Pin(13, Pin.OUT) # TR: Yesil LED | EN: Green LED
14
15# ============ BASLANGIC / INIT ============
16# TR: Biri acik biri kapali baslasin | EN: Start with opposite states
17led1.value(1)
18led2.value(0)
19
20print("== BlueGrays: 2 LED Alternatif ==")
21print("LED1 (Kirmizi): GP14 | LED2 (Yesil): GP13")
22
23# ============ LOOP ============
24while True:
25 # TR: Iki LED'i ters cevir | EN: Toggle both LEDs
26 led1.toggle()
27 led2.toggle()
28 sleep(0.5) # TR: 500 ms bekle | EN: 500 ms delay
29