[英]Arduino button press representing boolean variable in python
How can I make a boolean variable set to True
in python when button pressed, so that I could have the python program execute something each time the button is pressed.按下按钮时,如何在python中将布尔变量设置为True
,以便每次按下按钮时都可以让python程序执行某些操作。
if button_pressed:
print('button was pressed')
I guess you should connect the pins for button in your python script.我想你应该在你的 python 脚本中连接按钮的引脚。
Maybe this medium article helps you out!也许这篇中等文章可以帮到你!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.