What else did you do to your bike? Can you share your code?
Thanks! Have a safe ride!
--
You received this message because you are subscribed to the Google Groups "bmw-canbus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bmw-canbus+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bmw-canbus/c8820b42-741b-4ad0-831e-43b9d3a0306e%40googlegroups.com.
float currentMillis = 0;int currentClickCount = 0;float lastClickedTime = 0;
void listenTripleClicks() { if (button_pressed) // Some logic that catches button press {
// If this is the first button press, then we increment the counter by one if (currentClickCount == 0) { currentClickCount = 1; }
// Button is pressed again within 100ms else if ((currentMillis - lastClickedTime) <= 100) { currentClickCount += 1; // Increment the counter if (currentClickCount == 3) // If this is third consequent click, handle the action {
// dosometing and reset flags currentClickCount = 0; } }
else { currentClickCount = 1; // If button was not pressed again within 100ms, reset the counter to one. }
lastClickedTime = currentMillis; // Set current time as last click time }
}
}
void loop() { currentMillis = millis(); listenTripleClicks();}
--
You received this message because you are subscribed to the Google Groups "bmw-canbus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bmw-canbus+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bmw-canbus/f7937c90-6540-4fcb-8252-d0ed2547dca5n%40googlegroups.com.