Arduino uno giving weird analogWrite output

Grumpy_Mike:
Yes it will.
Analog read returns a 10 bit value that is between 0 and 1023.
Where as analog write takes in an 8 bit value, that is from 0 to 255.
So when you give the analog write 256 it wraps round and in effect gives zero.
To stop this from happening use:-

red = analogRead(A0) >> 2;

Which basically divides the reading by four.

Moderator edit: Hmmm.

well this device was not working like divide by four it would equal the exact same as the pont, worked fine before the device glitched out, but what I want to know is how to actually get 1024 out of the led. not 255.