253 views|0 replies

6027

Posts

6

Resources
The OP
 

【Follow me Season 2 Episode 1】Practice step by step: Keystrokes [Copy link]

 
The buttons of Circuit Playground Express include a slide switch (D7) and two tactile buttons (D4, D5).
Let's first look at the slide switch (D7):
The related encapsulation of the slide switch is also in cp, and the corresponding identifier is switch. We realize the state of the red LED through the state of this slide switch:
from adafruit_circuitplayground import cp
while True:
	cp.red_led = cp.switch

The other buttons are two light touch buttons (D4, D5):

Circuit Playground Express has two buttons. Button A is on the left and Button B is on the right. This has something to do with the internal markings. These buttons can be used as inputs.
from adafruit_circuitplayground import cp
while True:
	if cp.button_b:
		cp.red_led = True
	else:
		cp.red_led = False

This post is from DigiKey Technology Zone
Personal signature

在爱好的道路上不断前进,在生活的迷雾中播撒光引

 
 

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