Can anyone please tell me what is wrong with this code??

int k=0;
int c=0;
float voltage;
void setup() {
  Serial.begin(9600);
}

void loop() {
  k=0;
  c=0;
  while(k<10000){
    int sensorValue = analogRead(A0);
    voltage = sensorValue * (5.0/1023.0);
    if(voltage > 1.0){
      c++;
    }
    delay(1);
  }
  Serial.println(c);
int rate = 6*c;
Serial.println(rate);
}

I am not getting any serial output.

You set 'k' to zero and next test if it's less than 10000. That will always be true because you never increment 'k'.

Yes,of course,Thats a nasty mistake..Thank you very much. :slight_smile: