-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TwoButtons , only the first button work, the second button can not work。两个按键错误。 #137
Comments
我发现了问题,因为我在loop里调用了fastled库中的fill_rainbow((leds), 64, 0, 4); |
问题已经解决了,是因为在调用fastled的时候数量搞错了导致的。 |
so problem solved, it was a bug in your code. this could be closed, right? |
Yes, thank you.
At 2024-01-10 21:01:37, "JM" ***@***.***> wrote:
so problem solved, it was a bug in your code. this could be closed, right?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#include <OneButton.h> //OneButton库,按钮按下与长按操作
OneButton button1(15,false,false); //左侧按钮,D8-GPIO15,靠近芯片的插座
OneButton button2(4,false,false); //右侧按钮,D2-GPIO4,远离芯片的插座
void button1Click(){ //单击button1时运行
Serial.print("button1Click");
}
void button2Click(){ //单击button2时运行
Serial.print("button2Click");
}
void setup(){
Serial.begin(9600);
while(!Serial);
Serial.println("Ready");
button1.reset();
button1.attachClick(button1Click);
button2.reset();
button2.attachClick(button2Click);
}
void loop()
{
button2.tick();
button1.tick();
}
According to the above code, only button1 can work.
If the order is reversed below, only button2 can work.
OneButton button2(4,false,false); //右侧按钮,D2-GPIO4,远离芯片的插座
OneButton button1(15,false,false); //左侧按钮,D8-GPIO15,靠近芯片的插座
用OneButton库定义了两个按钮,但是只有前面一个被定义的可以工作,后一个不工作,调换顺序之后还是前面一个可以工作,求助,为什么?哪里错了?
/
The text was updated successfully, but these errors were encountered: