void setup() {
Serial.begin(9600); //begin serial communication
pinMode(A0,INPUT); //A0 is an input
pinMode(9, OUTPUT); //pin 9 is an output
}
void loop() {
int dialValue=analogRead(A0); //read from pin A0 and store it to variable
int newValue = map(dialValue,0,1023,0,255); //newValue now ranges from 0 to 255
Serial.print("The dial Value is " ); //print text
Serial.print(dialValue); //print that value
Serial.print(" The new Value is "); //print text
Serial.println(newValue); //print that value with a new line
analogWrite(9,newValue); //send that newValue value to pin 9
}