8 seconds of a flashing LED using #RaspberryPi #pico

Starting our Easter holiday coding sessions simple, using a Raspberry Pi Pico to flash an LED using MicroPython via Thonny on a RPi4

Started with a bit of a stumbling block as wrongly assumed the breadboard ports on the Pimoroni Pico explorer ran horizontal but they actually run vertically!

Once components had been switched (and also the LED anode the right way round) we had a simple flashing LED.

This was the code we used…

from machine import Pin
import utime
led = Pin(4, Pin.OUT)
led.low()
while True:
    led.toggle()
    print("Flash")
    utime.sleep(1)

Thrilling isn’t it 😄

Circuit as follows:

GND to 330 ohm resistor

330 ohn resistor to LED cathode

LED anode to Pico GP4

Related Post

Leave a Reply