Hello,
I am just getting started with the Arduino Duemilanov and I have a question. I have been playing with the Blink Sketch and everything I have read so far says that when you do digitalWrite and HIGH code that the pin is set to 5 volts. I put a volt meter on pin 13 which has been set to OUTPUT is about 1.5 volts. Is this correct or should it be 5 volts?
If you set the pinMode() as OUTPUT, and then set the output logic value using digitalWrite() to bring it HIGH, it should give you somewhere like 80% to 99% of your Vdd, so between 4.0 and 5.0 VDC compared to ground. This is enough to be seen as a HIGH value, and even a little drag like 4.5V should be equivalent to 5.0V to digital circuits. Sounds like you forgot to set the pinMode()? Or you're not measuring voltage against ground correctly?
Thanks for the quick reply.
I am using the example code for led Blink, which I think has everything set correctly. I changed the delay to 1 ms so that to the voltage would stay steady. I am testing the voltage between pin 13 and ground pin right next to it. Should I be testing it differently? I did test the 5v pin and its ground and it reads 5.3 and the 3.3v pin and it reads 3.88. I have the Arduino connected to my computer with the USB cable. Any other suggestions?
/*
Blink
The basic Arduino example. Turns on an LED on for one second,
then off for one second, and so on... We use pin 13 because,
depending on your Arduino board, it has either a built-in LED
or a built-in resistor so that you need only an LED.
int ledPin = 13; // LED connected to digital pin 13
void setup() // run once, when the sketch starts
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}
void loop() // run over and over again
{
digitalWrite(ledPin, HIGH); // sets the LED on
delay(1); // waits for a second
digitalWrite(ledPin, LOW); // sets the LED off
delay(1); // waits for a second
}
"I changed the delay to 1 ms so that to the voltage would stay steady. I am testing the voltage between pin 13 and ground pin right next to it. "
Changing the delay time to one millisecond would do the opposite from keeping it steady, it will be switching between 5vdc and 0vdc at a very fast rate and your meter would at best be responding to an average voltage output. Change the delay to 10 seconds and your meter should show around 5vdc for 10 and 0vdc for 10.
"Good point, the voltage did go up to 2.9v. It should be at least 4 volts right? "
Well if it's wired to the LED then there will be a little voltage drop because of the current draw of the LED. If you change the program to a different ouput pin with no load wired to it you should see a higher voltage. The exact value depends of some variables that include the exact Vcc voltage to the chip, the temperature and the phase of the moon. If you want the best information avalible for these kind of specifications is the AVR data sheet for the 168P and is free to download here: