129 views|0 replies

183

Posts

12

Resources
The OP
 

【Follow me Season 2 Episode 1】Introductory Task, Basic Task 1: Lighting the Lamp [Copy link]

 This post was last edited by nemon on 2024-8-31 19:06

After getting the Adafruit Circuit Playground Express, first go to the official website ( https://learn.adafruit.com/adafruit-circuit-playground-express ) and take a look around, then you will know how to get started.

First, I flashed the latest version of the firmware - the so-called Pinyin version. The output was actually Pinyin, which was really tiring to read, so I flashed the English version:

adafruit-circuitpython-circuitplayground_express-en_US-9.1.1.uf2 (485 KB, downloads: 0)

Then I installed MU ( https://download.eeworld.com.cn/detail/nemon/634235 )

The entry-level task requires "building the development environment and lighting up the onboard LED", and the basic task requires "controlling the onboard colorful LED, lighting up the marquee and changing the color", so I went to the board to find resources.
The Adafruit Circuit Playground Express has 1 red LED and 10 three-color full-color LEDs, which is enough.

There is an official adafruit_circuitplayground library that encapsulates the resources on the board. The LED can be referenced using red_led, and the colorful lights can be used using pixels.

So the code is simple:

import time
from adafruit_circuitplayground import cp as my_cp
my_cp.pixels.brightness=0.1

while True:
    for i in range(100):
        for j in range(10):
            my_cp.pixels[j]=( 25*(i%10), 0+25*((j-i)%10) , 255-25*((j-i)%10) )
        if i%50==0:
            my_cp.red_led = (i==0)
        time.sleep(0.01)
        print(i,end=' ')

The convention of CircuitPython is that code.py will be executed automatically, so save the above file as code.py.

Here, in order to demonstrate the LED, the colorful light changes on and off every 5 turns.

The effect is like this:


This post is from DigiKey Technology Zone
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list