int potValue;
int mappedpotValue;
void setup() {
// put your setup code here, to run once:
pinMode(3,OUTPUT);
pinMode(A0,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
// Sensor Read
potValue= analogRead(A0); // 0-1023
// Mapping
mappedpotValue=map(potValue,0,1023,0,255);
// Analog Write
analogWrite(3,mappedpotValue);
}