Whenever I run the code, it just prints zeros.
And it doesn't work on any other pin on the Arduino.
Can there be a problem In the Arduino ? (as my Arduino is a counterfeit).
OR
a problem in my code
Yes since the default timeout for pulseIn() is exactly one second that's pretty definitely what's happening.
So it seems that the "sound sensor" isn't creating a pulse. Exacty what "sound sensor" is it? And have you tried adjusting the sensitivity control that most of them have? It may either be too insensitive so it never fires at all or over sensitive so that the output is high all the time. Do you have a DMM so you can measure the voltage on that output?
Try changing the command to pulseIn(7, HIGH, 2500000) and report back if anything changes.
slipstick:
Do you have a DMM so you can measure the voltage on that output?
Try changing the command to pulseIn(7, HIGH, 2500000) and report back if anything changes.
Steve
I don't have a DMM to measure the voltage on the OUTPUT of pin '7'.
I tried the same code on all digital pins on the Arduino with a simple switch but it didn't work on even a single one.
I also tried pulseIn(7,HIGH, 2500000) but it didn't work as well.
I guess there is a problem in my Arduino UNO and I have posted my problem in the Forum as well.
Adivijaya:
I also tried pulseIn(7,HIGH, 2500000) but it didn't work as well.
The question was did it change anything...in particular did you get zeros printed more slowly, like every 2.5 seconds?
I also asked what type of sound sensor you had and if you had done any adjustments to any potentiometer it has. You didn't bother to answer that either. If you won't provide necessary information there's really no point in trying to help you.