Hi out there.
I have copied the example from https://z-uno.z-wave.me/Reference/ZUNO_ ... addButton/
and it works well.
In the text there is a hint of BtnButtonModeExtInt wich you can use instead of BtnButtonModeTimer
in the example.
My question is, how do I set up an ISR and let the interrupt find its way to that ISR.
I found out that attachInterrupt() is not working in this case.
Z-Uno v2, 3.0.10, Razberry 7 Pro, RaspBerry 4
SDK Version: 7.15.00
Serial API Version: 07.05
Very thankful in advance.
Btn.addButton() with interrupt
Re: Btn.addButton() with interrupt
Hello.KGBEl wrote: ↑29 Feb 2024 12:00Hi out there.
I have copied the example from https://z-uno.z-wave.me/Reference/ZUNO_ ... addButton/
and it works well.
In the text there is a hint of BtnButtonModeExtInt wich you can use instead of BtnButtonModeTimer
in the example.
My question is, how do I set up an ISR and let the interrupt find its way to that ISR.
I found out that attachInterrupt() is not working in this case.
Z-Uno v2, 3.0.10, Razberry 7 Pro, RaspBerry 4
SDK Version: 7.15.00
Serial API Version: 07.05
Very thankful in advance.
Replace
Code: Select all
init.mode = BtnButtonModeTimer;
Code: Select all
init.mode = BtnButtonModeExtInt;
Re: Btn.addButton() with interrupt
Thank you for answering, I did that but I haven't found out how to catch the button press.
How do I set up an isr so I can catch the interrupt?
How do I set up an isr so I can catch the interrupt?
Re: Btn.addButton() with interrupt
If you check button presses, then as in the example:
Code: Select all
void process_buttons() {
if(Btn.isSingleClick(BUTTON)) {
Serial0.println("isSingleClick");
if (dimmerValue == 5)
dimmerValue = 100;
else
dimmerValue = 5;
}
if(Btn.isTripleClick(BUTTON)) {
Serial0.println("isTripleClick");
if (dimmerValue == 5)
dimmerValue = 100;
else
dimmerValue = 5;
}
if(Btn.isLongClick(BUTTON)) {
Serial0.println("isLongClick");
if (dimmerValue == 5)
dimmerValue = 100;
else
dimmerValue = 5;
}
if(Btn.isDoubleClick(BUTTON)) {
Serial0.println("isDoubleClick");
if (dimmerValue == 5)
dimmerValue = 100;
else
dimmerValue = 5;
}
}
You need to use attachInterrupt https://z-uno.z-wave.me/Reference/Inter ... Interrupt/ instead of this class.
Re: Btn.addButton() with interrupt
Thank you for answering.
If I understand you right, there is no way to use BtnButtonModeExtInt and get an
answer to pushed button without polling the Btn.xxxx for events.
Best is to use attachInterrupt() an work around?
If I understand you right, there is no way to use BtnButtonModeExtInt and get an
answer to pushed button without polling the Btn.xxxx for events.
Best is to use attachInterrupt() an work around?
Re: Btn.addButton() with interrupt
One more question, is there a plan for getting an callback on BtnButtonModeExtInt?
Re: Btn.addButton() with interrupt
Thank you very much for your answers, appreciated.