int motorPin = 9;
int potPin = A0;
void setup() {
pinMode(motorPin, OUTPUT);
}
void loop() {
int potValue = analogRead(potPin);
int pwmValue = map(potValue, 0, 1023, 0, 255);
analogWrite(motorPin, pwmValue);
}
int motorPin = 9;
int potPin = A0;
void setup() {
pinMode(motorPin, OUTPUT);
}
void loop() {
int potValue = analogRead(potPin);
int pwmValue = map(potValue, 0, 1023, 0, 255);
analogWrite(motorPin, pwmValue);
}