3595 views|0 replies

1w

Posts

25

Resources
The OP
 

【ESP32 Learning】Using buttons [Copy link]

 
There are two buttons on the board, one is the reset button and the other is the programming/user button. The user button uses GPIO0. We set it to input mode and then we can read the button status. The following program first reads the button status and then sets the LED. Because the button is low effective, the output is negated (not).
  1. from machine import Pin SW = Pin(0, Pin.IN) LED = Pin(21, Pin.OUT) while 1: LED(not SW())
复制代码
This content is created by EEWORLD forum user dcexpert. If you need to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source

 
 

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