#define RPMMAX 1820
#define PRMMIN 800
#define LEDUP 0
#define LEDDOWN 1
#define READTIME 1000 //time in miliseconds
#define pulses 4
int main()
void setup() //use for setup hardware only one time
{//execute this when connect/ push reset
pinMode(LEDIP , INPUT);
pinMode(LEDDOWN, OUTPUT);
}
void loop()//repeat this code forever and ever
{
int rpm = (pulses/4) * 60
declare variable named rpms
declare variable actualInput = 0
declare variable storagedInput = 0
check ->time is < 1 second
if this true
{
rpms = (pulses/4) * 60
check -> rpms > RPMMAX
if this true
{
set on LEDUP
}
or, if this false
{
set OFF LEDUP
}
check -> rpms < RPMMIN
if this true
{
set ON LEDDOWN
}
or, if this false
{
set OFF LEDDOWN
}
}
or, if this false
{
actualInput = readInput in port DIS
check actualInput != storagedInput
if this true
{
pulses = pulses + 1
}
or, if this false
{
nothing XD
}
storagedInput = actualInput
}
}