#define LEDPIN 3
#define POTPIN A0
void setup() {
Serial.begin(115200);
pinMode(LEDPIN, OUTPUT);
pinMode(POTPIN, INPUT);
}
void loop() {
int pwm = map(analogRead(POTPIN), 0, 1023, 0, 255);
digitalWrite(LEDPIN, pwm);
if (pwm < 100) Serial.print(" ");
if (pwm < 10) Serial.print(" ");
Serial.print(pwm);
for (int i = 0; i < pwm / 5; i++) {
Serial.print(" ");
}
Serial.println("*");
delay(100);
}