When I apply analogWrite(255) I got 4.66 volt on my voltmeter.
Check the supply voltage. The analog output can't go higher than the supply. USB?
Indeed, tried usb and then tried external 9 V supply and still same 4.66v :~
What is the supply voltage? Measure from 5v to Gnd.
Supply voltage is 9v
Measure from pin 9 to Gnd.
Code I took from basic fade example
int led = 9; // the pin that the LED is attached to
int brightness = 255; // how bright the LED is
// the setup routine runs once when you press reset:
void setup() {
// declare pin 9 to be an output:
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// set the brightness of pin 9:
analogWrite(led, brightness);
}
Supply voltage is 9v
No it is not.
That is the voltage going into the voltage regulator. You need to measure the voltage coming out of the regulator. That is the supply voltage for the chip and determines the voltage you get out of the pins.
This voltage will appear on the 5V pin measure from that to ground and report back.
And how can measure after voltage regulator?
At the 5V rail.
flash_os:
And how can measure after voltage regulator?
!!!!!!!
I just told you. It comes out of the 5V pin on the Arduino.
Thank you.
I'm a newbie.
You mean to take measurement from this points 5v and gnd:
I'm measured 4.94v on it.
What kind of load do you have on the pin?
4.94 volt
Is it normal?
flash_os:
4.94 volt
it's normal?
If you mean at the 5V pin, then yes that is fine. At a digital output pin it can be no more then that and actually less depending on the what you have wired to an output pin. 4.66 vdc could be perfectly normal.
Do you have seen this question:
What kind of load do you have on the pin?
What is the answer?
What kind of pin?
The pin you are using for analogWrite.
4.66 volt
The question is, what kind of a load do you have on the pin you are using for analogWrite(255)?
An LED, of course, which as Retrolefty said:
http://forum.arduino.cc/index.php?topic=250236.msg1782135#msg1782135
... At a digital output pin it can be no more then that and actually less depending on the what you have wired to an output pin. 4.66 vdc could be perfectly normal.
So what he is saying is that, under load, the output of a pin drops below Vcc. I'll bet if you remove the LED, the output will be a lot closer to the 4.94V that you measured on the 5V line. But still, it may be below that.
Do you understand that analogWrite(n) outputs a PWM signal, not an analog voltage? I say that because while 255 will read fine on a digital meter, as it is 100% duty cycle, lower settings may cause weird numbers to appear on a digital meter. The LED will still smoothly fade, as it relies on the persistence of vision of our eyes. The LED will still be blinking on and off, something you can confirm at lower numbers by either waving the circuit around, or moving your head around quickly.
Thanks.