Pico W chaser
Six lamps sweeping on the breadboard. A Pico W has no LED of its own (that one is on the radio chip), so every lamp here is one you wired. The whole build, a Raspberry Pi Pico W and 12 more parts, runs here in your browser on the firmware below; open it in the editor to change the wiring or the code and run it again.
Runs in your browser. Free, and no account needed.
The code
The firmware exactly as the editor opens it. Change a line there and press Run: it compiles in the browser.
// Chaser: a dot sweeping back and forth along six LEDs.
//
// One GPIO per lamp: GP2 to GP7, in order along the Pico's left header. No
// shift register, no PWM, just six pinMode calls and a loop, the same
// circuit as the ESP32-C3 Knight Rider example, wired to a different board.
//
// The sweep turns round one short of each end, so the two end lamps light
// once a pass and the middle ones twice.
const int LAMPS[] = {2, 3, 4, 5, 6, 7};
const int COUNT = 6;
const int STEP_MS = 90;
static void show(int lit) {
for (int i = 0; i < COUNT; i++) {
digitalWrite(LAMPS[i], i == lit ? HIGH : LOW);
}
}
void setup() {
for (int i = 0; i < COUNT; i++) {
pinMode(LAMPS[i], OUTPUT);
digitalWrite(LAMPS[i], LOW);
}
Serial.begin(115200);
Serial.println("Mokxi Pico: six lamps, one dot");
}
void loop() {
for (int i = 0; i < COUNT; i++) {
show(i);
delay(STEP_MS);
}
for (int i = COUNT - 2; i > 0; i--) {
show(i);
delay(STEP_MS);
}
}
Parts list
14 parts, plus the jumper wires. Every one is in the editor's parts bin.
- 1 × Raspberry Pi Pico W
- 1 × Full-size breadboard
- 6 × Resistor, 220 Ω
- 6 × LED, red
How it is wired
13 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.
- Raspberry Pi Pico W pin GP2; Resistor, 220 Ω (1) pin 1
- Raspberry Pi Pico W pin GP3; Resistor, 220 Ω (2) pin 1
- Raspberry Pi Pico W pin GP4; Resistor, 220 Ω (3) pin 1
- Raspberry Pi Pico W pin GP5; Resistor, 220 Ω (4) pin 1
- Ground: Raspberry Pi Pico W pin GND; LED, red (1) pin C; LED, red (2) pin C; LED, red (3) pin C; LED, red (4) pin C; LED, red (5) pin C; LED, red (6) pin C
- Raspberry Pi Pico W pin GP6; Resistor, 220 Ω (5) pin 1
- Raspberry Pi Pico W pin GP7; Resistor, 220 Ω (6) pin 1
- Resistor, 220 Ω (1) pin 2; LED, red (1) pin A
- Resistor, 220 Ω (2) pin 2; LED, red (2) pin A
- Resistor, 220 Ω (3) pin 2; LED, red (3) pin A
- Resistor, 220 Ω (4) pin 2; LED, red (4) pin A
- Resistor, 220 Ω (5) pin 2; LED, red (5) pin A
- Resistor, 220 Ω (6) pin 2; LED, red (6) pin A
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.