Skip to content

Instantly share code, notes, and snippets.

@esmarr58
Created November 15, 2017 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esmarr58/f1cb073352f1e3d81cbaf45c33e81dd7 to your computer and use it in GitHub Desktop.
Save esmarr58/f1cb073352f1e3d81cbaf45c33e81dd7 to your computer and use it in GitHub Desktop.
volatile int NbTopsFan;
int Calc;
int hallsensor = 2;
void rpm ()
{
NbTopsFan++;
}
void setup()
{
pinMode(hallsensor, INPUT);
Serial.begin(9600);
attachInterrupt(0, rpm, RISING);
}
void loop ()
{
NbTopsFan = 0;
sei();
delay (1000);
cli();
Calc = (NbTopsFan * 60 / 5.5);
Serial.print (Calc, DEC);
Serial.print (" Litros/min\r\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment