Arduino Code For Rev-Limiter
Arduino Code For Rev-Limiter
//
//Written by Adrianos
Botis: adrianosbotis@gmail.com
//
//Use at your own and change the parameters:
rpm_val to set the rpm limit of your engine.
//You can also change the delay
of milliseconds at the end of the code to set how fast your engine will be
switched
on-off.
//
int sensor_pin = 3;
// set number of hall trips for
RPM reading (higher improves accuracy)
float sensor_thresh = 5.0;
int ignition
= 2;
void setup() {
// initialize serial communication at 9600 bits
per second:
Serial.begin(9600);
// make the sensor pin an input:
pinMode(sensor_pin,
INPUT);
pinMode(ignition, OUTPUT);
}
}
} else{
on_state = false;
}
if (hall_count>=sensor_thresh){
break;
}
}
digitalWrite(ignition, HIGH);
}
else {
digitalWrite(ignition,
LOW);
}
Serial.print(rpm_val);
delay(1); // delay in
between reads for stability
}