So I'm doing a project and I need to make a state change detection infrared sensor that can "sense" and recollect the data in a specific period of time before resetting again. Basically I need to do a tachometer with this sensor but I'm having difficulties making the program.
My program is currently as follows:
int rpm=0;
float t=0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(9,OUTPUT);
pinMode(A5,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
I'm just looking for some direction to correctly make the code. Currently my code starts counting when there's something in front of it, I want my code to count when something passes in front of it not when there's something in it.
The sensor is sensing the time count a propeller is spent in front of the sensor, instead of how many revolutions this propeller does. As for the motor its a generic DC motor.