1. Blinking LED

Objective

You are going to create a simple circuit using an LED light. The goal is to have the LED light turn on for 2 seconds, and then turn off for 1 second.

Components

  • 1 Metro M0 Express

  • 1 breadboard

  • 1 resistor (330 ohms)

  • 1 LED light

  • Wires

Wiring

Follow the circuit diagram provided to wire the Metro M0 Express.

Note: For the LED light, shorter leg goes to GND (ground), and longer leg goes to a pin. Ground is the reference point in an electrical circuit which voltages are measured (usually zero).

Coding/Programming

import board

import digitalio

import time

led = digitalio.DigitalInOut(board.D13)

led.direction = digitalio.Direction.OUTPUT

while True:

led.value = True

time.sleep(2)

led.value = False

time.sleep(1)