🍞
Breadstick
  • Breadstick Innovations Website
  • Breadsticks
    • đŸĨ–Raspberry Breadstick
      • Code Examples
        • Demo Code
        • POV Wand
        • Pride Flags POV Wand
        • 6-Axis IMU
        • RGB Blink
        • AsyncIO RGB Blink
        • Digital Input
        • Digital Output
        • PWM
        • ADC
        • Servo Motor
    • đŸĨ–Raspberry Breadstick Lite
    • 🍞Support Boards
      • I2C Devices
        • 🚌I2C Bus Rail Adapter
        • đŸŒĻī¸Weather Crouton
        • 😎Brightness Crouton
        • 📏Distance Crouton
        • đŸĢ¨Motion Crouton
      • I2S Devices
        • đŸ“ĸBoombox
      • SPI Devices
      • đŸ•šī¸Buttons/Switches
    • Learning Resources
    • Troubleshooting
  • Nougat
    • Nougat C3
    • Nougat Quad
    • Installing WLED
  • Pico Slices
    • 🔴Slice 1 - LED Mixer
      • Assembly Guide
      • CircuitPython Code
        • 1 - Blink
        • 2 - Analog Read to Plotter
        • 3 - PWM Fade
        • 4 - Pot Controlled PWM
        • 5 - Gamma Correction
    • âąī¸Slice 2 - Stopwatch
      • Assembly Guide
      • Coding Lessons
        • 1 - 7-Segment Display Intro
        • 2 - Cycling Through All Segments
    • âŦœSlice 3 - 8x8 Dot Matrix
      • Assembly Guide
      • MicroPython Code
        • 1 - Moveable Pixel
        • 2 - Snake
    • Circuit Python Setup
    • Reset Bricked Pico
  • Christmas
    • Christmas Tree DIY kit
  • Protoboards
    • â¤ī¸Proto-Heart
    • đŸĨĒProto-Toast
  • SHOP
Powered by GitBook
On this page
  • Creation of the blue LED - Won a Nobel Prize!
  • Code

Was this helpful?

  1. Breadsticks
  2. Raspberry Breadstick
  3. Code Examples

Digital Output

PreviousDigital InputNextPWM

Last updated 1 year ago

Was this helpful?

Creation of the blue LED - Won a Nobel Prize!

Code

"""
Digital Output Demo Code
Breadstick Innovations
April 26, 2024
https://learn.breadstick.ca/breadstick/breadsticks/raspberry-breadstick/code-examples/digital-output
"""

from board import *
from digitalio import DigitalInOut
from time import sleep

led_5 = DigitalInOut(D5)
led_5.switch_to_output()

while True:
    led_5.value = True
    sleep(1)
    led_5.value = False
    sleep(1)
đŸĨ–
A blue LED, a 180 Ohm resistor, and an orange jumper wire.
It may seem like a simple blue light, but there's an incredible story of innovation and tenacity behind blue LEDs.
Orange jumper wire connects the blue bus-rail to GND.
Anode (+) of LED connected to D5, Cathode (-) connected to 180 Ohm resistor, resistor connected to GND.
When LED_5.value = True, D5 gets set to 3.3V, forward biasing the light emitting diode.