The code is below;
The transistor is fed directly from the 5v and gnd rails.
The POT is fed likewise and the center rail links to analog 0.
How does the POT intervene with the direct 5v supply and reduce it?
The book doesn't explain the interactions.
Thanks!
/
int potPin = A0;
int motorPin = 9;
int potValue = 0;
int motorValue = 0;
void setup() {
Serial.begin(9699);
}
void loop() {
potValue = analogRead(potPin);
motorValue = map(potValue,0,1023,0,255);
analogWrite(motorPin, motorValue);
Serial.print("potentiometer = ");
Serial.print(potValue);
Serial.print("\t motor = ");
Serial.println(motorValue);
delay(2);
}
/