You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I love this it’s great - I’m just wanting to tweak it a bit so that when the next led is illuminated the previous goes out - can you specify a rpm range somehow as the values for each led? Like ‘[4000-4999],[5000-5999],[6000]’
Thank you!
The text was updated successfully, but these errors were encountered:
void setLedState(int rpm) {
setGlobalState(LOW);
// If rpm is over REV_LIMITER_RPM, all leds should be blinking at 200ms interval
if (rpm > REV_LIMITER_RPM) {
if (revLimiterOn) {
setGlobalState(LOW);
} else {
setGlobalState(HIGH);
}
revLimiterOn = !revLimiterOn;
return;
}
// Holds the index of the highest LED to turn on
int maxPin = -1;
for (int i = 0; i < PINS_COUNT; i++) {
if (rpm >= LED_SWITCH_RPM[i]) {
// Set the LED index
maxPin = i;
} else {
// No sense in continuing the loop since the remaining RPM values are too high
break;
}
}
// Only turn on the LED we flagged above
if (maxPin > -1) {
digitalWrite(maxPin, HIGH);
}
}
Hi I love this it’s great - I’m just wanting to tweak it a bit so that when the next led is illuminated the previous goes out - can you specify a rpm range somehow as the values for each led? Like ‘[4000-4999],[5000-5999],[6000]’
Thank you!
The text was updated successfully, but these errors were encountered: