Analogout AnalogWrite

For the first time, I have used UNO R3.
Using sample and modifying it, I connected analogout pin 9 to analogy A0.
Confirming the out voltage has my willingness, but, analog data is not almost 0 and max 1023.

Please show me the resolution method.

Best regards

Hiroyasu Matsuda___________________________________

const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to
int sensorValue=0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)
void setup() {
// initialize serial communications at 9600 bps:
void loop() {
sensorValue = analogRead(analogInPin);
analogWrite(analogOutPin, outputValue);
Serial.print("sensor = ");
Serial.print("\t output = ");
if( outputValue>256){ outputValue=0;}

analogWrite() outputs PWM (quickly switching it on and off), not an analog voltage.

You can get analog output from it with a simple (low pass) RC filter (I've seen 4.7k and 0.1uf, and 3.9k and 0.1uf recommended for typical situations with Arduino) - but oftentimes PWM is more useful.

Dear Sir
Thank you so much. It worked well by your recommendation.

Hiroyasu Matsuda