Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 1.02 KB

generate.md

File metadata and controls

26 lines (19 loc) · 1.02 KB

Circuit Configuration Code

Material for a UC Irvine course offered by the Department of Physics Astronomy and developed by David Kirkby.

Most programs have the same basic structure:

  • imports
  • circuit configuration
  • infinite loop

Here is a basic example from your first program:

import board
import digitalio
import time

led = digitalio.DigitalInOut(board.GP2)
led.direction = digitalio.Direction.OUTPUT

while True:
    led.value = not led.value # toggle on/off
    time.sleep(0.5) # seconds

The circuit configuration is where you specify the connections between your Pico and the rest of the circuit. Each connection is either an Input or an Output. The voltage that you connect to is either being treated as Digital or Analog.

Use this interactive tool to explore and generate code for the different options.