Created
November 15, 2017 01:28
-
-
Save esmarr58/f1cb073352f1e3d81cbaf45c33e81dd7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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