i have a hall effect encoder motor
ppm=827.1
i am using the following code for getting no of pulse per sec then converting it to rpm
volatile float count=0.00;
float rpm=0.00;
void setup() {
// put your setup code here, to run once:
pinMode(2,INPUT);
Serial.begin(9600);
}
void loop() {
//interrupts();
attachInterrupt(0,countf,RISING);
delay(1000);
Serial.println(count);
detachInterrupt(0);
rpm=count*(60.000/823.10000); //converting pulse per sec to rpm
Serial.print("rpm=");
Serial.println(rpm);
Serial.println(count);
count=0;
}
void countf()
{
count=count+1;
}
but i have getting a weird output
its rpm value is not stable it is getting decreasin
please see attached file for output
please help me here