0

My code is designed to play a tone when ever pin 3 is high on my Arduino. When I am examine the pins voltage with a multimeter it is always reading below 1 volt. When I examined the voltage off of a osiliscope it is reading the voltage pretty steady at 0.2 to 0.3.

My multimeter reads at 0.26

:

My code is:

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
  // put your main code here, to run repeatedly:
int input = digitalRead(3);
Serial.println(input);
if(input == 1){
  tone(A5,4000);
  }
}

My board looks like: enter image description here The bottom of the board looks like: enter image description here

1
  • What pin are you measuring exactly? Pin 3 or pin A5? Is there a resistor in series with that LED? Is there a pull-up or pull-down resistor on pin 3? See Switches Tutorial.
    – Nick Gammon
    Commented Aug 13, 2015 at 3:33

1 Answer 1

1

You left pin 3 floating. The multimeter will lower the voltage, resulting the the led lighting. Try enabling the pull-up resistor in pin 3 by adding pinMode(3, INPUT_PULLUP).

PS you might want to add a resistor in series with that led, or it will burn out and/or damage pin 3 on the arduino.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.