Getting Started with Raspberry Pi Pico and CircuitPython

Getting Started with Raspberry Pi Pico

and CircuitPython

Created by Kattni Rembor



Last updated on 2024-06-21 12:20:59 PM EDT

?Adafruit Industries

Page 1 of 95

Table of Contents

Overview

5

? Other Required Hardware

Pinouts

12

? No Basic Default board Devices

? The board.STEMMA_I2C() Object

? Power Sensing Pins Available in CircuitPython

Using Adafruit AR with Raspberry Pi Pico

15

? To get started:

MicroPython or CircuitPython?

?

?

?

?

?

17

CircuitPython is a 'fork' based on MicroPython

So what's different?

Why Use MicroPython?

It's great to know both!

To get started quick:

What is CircuitPython?

19

? CircuitPython is based on Python

? Why would I use CircuitPython?

Installing CircuitPython

21

? CircuitPython Quickstart

? Flash Resetting UF2

Installing the Mu Editor

24

? Download and Install Mu

? Starting Up Mu

? Using Mu

CircuitPython Programming Basics

26

? Indentation and Code Loops

? Conditionals and Variables

CircuitPython Pins and Modules

?

?

?

?

?

?

CircuitPython Pins

import board

I2C, SPI, and UART

What Are All the Available Names?

Microcontroller Pin Names

CircuitPython Built-In Modules

Blinky and a Button

?

?

?

?

32

38

The Built-In LED

An External LED

Using a Button as an Input

Control an External LED with a Button

Traffic Light and Pedestrian Crossing

49

? Parts Used

?Adafruit Industries

Page 2 of 95

?

?

?

?

?

Wiring the Traffic Light

Programming the Traffic Light

Traffic Light and Pedestrian Crossing

Wiring the Pedestrian Crossing

Programming the Traffic Light and Pedestrian Crossing

Reaction Game

?

?

?

?

?

?

Parts Used

Wiring the Reaction Game

Programming the Reaction Game

Two Players Makes It More Fun

Wiring the Two Player Reaction Game

Programming the Two Player Reaction Game

Burglar Alarm

?

?

?

?

?

?

?

?

?

58

65

Wiring the Basic Motion Sensor

Programming the Basic Motion Sensor

Burglar Alarm

Wiring the Burglar Alarm with Light

Programming the Burglar Alarm with Light

Wiring the Burglar Alarm with Light and Sound

Programming the Burglar Alarm with Light and Sound

Wiring the Extended Burglar Alarm with Light and Sound

Programming the Extended Burglar Alarm

Potentiometer and PWM LED

76

? Reading a Potentiometer

? Using PWM to Fade an LED

Temperature Gauge

82

Data Logger

83

?

?

?

?

Data Logger Wiring

Programming the Temperature Data Logger

Data Logger Without Wiring

Using the REPL to Rename boot.py

NeoPixel LEDs

87

? Wiring the NeoPixel LED Strip

? Installing the Adafruit CircuitPython NeoPixel Library

? Programming NeoPixel LEDs

FAQ and Troubleshooting

94

? FAQ

? board.I2C(), board.SPI(), and board.UART() do not exist. What should I do?

? Is pulseio supported?

CircuitPython Essentials

94

Downloads

94

?Adafruit Industries

Page 3 of 95

?Adafruit Industries

Page 4 of 95

Overview

The Raspberry Pi foundation changed single-board computing when they released

the Raspberry Pi computer (), now they're ready to do the same for

microcontrollers with the release of the brand new Raspberry Pi Pico. This low-cost

microcontroller board features a powerful new chip, the RP2040, and all the fixin's to

get started with embedded electronics projects at a stress-free price.

The Pico is 0.825" x 2" and can have headers soldered in for use in a breadboard or

perfboard, or can be soldered directly onto a PCB with the castellated pads. There's

20 pads on each side, with groups of general purpose input-and-output (GPIO) pins

interleaved with plenty of ground pins. All of the GPIO pins are 3.3V logic, and are not

5V-safe so stick to 3V! You get a total of 25 GPIO pins (technically there are 26 but IO

#15 has a special purpose and should not be used by projects), 3 of those can be

analog inputs (the chip has 4 ADC but one is not broken out). There are no true

analog output (DAC) pins.

?Adafruit Industries

Page 5 of 95

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download