int potPin=A0;
int potVal;
int redPin=A1;
int waitT=10;
float volts;
int bright;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(potPin,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
potVal=analogRead(potPin);
volts = (5.0/1023.0)*potVal;
bright = (255./1023)*potVal;
analogWrite(redPin,bright);
//this can be used to ensure that math is accurate.
/*String msg = String(potVal) + " Voaltage " + String(volts);
Serial.println(bright);
Serial.println(msg);*/
delay(waitT);
}