Lemontree

Circuit board based on CircuitPython programming

 
Overview
A circuit board based on CircuitPython programming
Introduction to CircuitPython
CircuitPython is a branch of micropython. The advantage of CircuitPython is that there are many libraries and drivers for sensors, breakout boards and other external components.
CircuitPython programming supports getting up and running quickly. After editing the code, save the file and it will run immediately. No need to compile, no need to download, no need to upload.
CPG-RP2040 circuit board introduction
Built-in 10 NeoPixels, each can display any color
1 attitude sensor (LSM6DS3TR-C accelerometer + gyroscope)
1 x temperature sensor (thermistor)
1 x color sensor (TCS34725FN). Also works as a pulse sensor.
1 x Sound Sensor (MEMS Digital Microphone)
1 x Mini Speaker with Class D Amplifier (8.5mm Magnetic Speaker/Buzzer)
2 x Buttons, labeled A and B
1 x Slide Switch
8 x Alligator Clip Friendly Inputs/Outputs Pins (includes I2C, UART, 8 pins for analog input, multiple PWM outputs)
2 ADC inputs
Green “ON” LED for power indicator
Yellow “WORK” LED Basic flashing
reset button
RP2040 ARM Cortex M0 Processor, running at 3.3V and 133MHz
16 MB of SPI flash storage, primarily used with CircuitPython to store code and libraries.
TypeC port for programming and debugging
The USB port can be used like a serial port, keyboard, mouse, joystick or MIDI!
 
 
Pin Definition Instructions
 
Pin definition description 
 
Software Guide
 
Before Beginning If you are new to programming and CircuitPython, please check out
the detailed introduction and usage of CircuitPython.
It is recommended to use Mu as a code editor because it has a built-in serial console and you can instantly start from within the editor. Get feedback on your code. For help installing Mu, read Installing the Mu Editor. Some features of this library work very well with the plotter functions available in the Mu editor. Please make sure to install the latest version to ensure you can access this feature of Mu.
If you already have a favorite editor, feel free to use it for this guide. Many of the examples will use a serial console, so if you choose not to use Mu and you've never connected to a serial console before, read Advanced Serial Console on Mac and Linux, or Advanced Serial Console on Windows , to help connect.
 
Install and update CircuitPython.
The latest version of CircuitPython that currently supports rp2040 is shown in the attachment:

adafruit-circuitpython-raspberry_pi_pico-en_US-7.3.2.uf2

The Circuit Playground library requires the following additional library files (see attachment lib.zip):
adafruit_register
adafruit_lsm6ds
adafruit_tcs34725
adafruit_thermister
neopixel
cpg_rp2040
If you try to run the code found in this guide without following these steps, the code will fail with the following error or a similar error:
Creating and Editing Code
 
Circuit Playground appears on your computer as a USB drive called CIRCUITPY. You may already have some files on your CIRCUITPY drive. CircuitPython looks for specific files to run the code they contain, including code.py. We'll put each piece of code in this guide into code.py in your CIRCUITPY drive. It's easy to remember: code.py is where the code lives. As you read this guide, you'll have several options for adding code from the guide to your panel.
You can download the file, rename it to code.py, and copy the file to your CIRCUITPY drive, replacing the current code.py if it already exists.
You can use your editor to copy and paste the code content from the guide into the current code.py file on your CIRCUITPY drive. Please make sure to replace all code in the current code.py. Don't add it to the end.
Both methods work. Which one to use is entirely up to you. If you're not sure which one to choose, try them out and see which workflow works best for you!
 
Using the Circuit PlayGround Library
No matter what type of board you're using, to use the Circuit Playground library, just add a Contain the following line of code at the beginning:

from cpg_rp2040 import cpr

That’s it! After that, you can start telling the board what to do.
 
For reference examples,
see attachment: Example.zip. Just rename the corresponding example to code.py and copy it to the "CIRCUITPY drive" to run it.
 
 
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-08 17:21:56

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号