Two buttons click - OPLA IoT Kit - MKRIoTCarrier

how to set function when pressing two buttons?

I tried this Button4 and 3 with and but does not work… any suggestions?
How I should do it?

  if (carrier.Button4.onTouchDown()) {
    modeSelect = 4;
  }
  
    if (carrier.Button4.onTouchDown() and carrier.Button3.onTouchDown()) {
    modeSelect = 1;
  }

The boolean operator you are looking for is &&, not and.
&& - Arduino Reference

You can use either:
https://en.cppreference.com/w/cpp/language/operator_alternative#Alternative_tokens

1 Like

I tested on both && also and it build in both cases but does not work as expected…
I guess maybe I expect too much?
maybe double click could work but not sure how I could program it…

ok I got it working

  if (carrier.Button4.getTouch() and carrier.Button3.onTouchDown()) {
    modeSelect = 1;
  }
2 Likes

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.