int motor_pin = 18;
int pot_pin = 4;
int pot_read = 0;
int motor_pwm = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(motor_pin, OUTPUT);
}
void loop() {
pot_read = analogRead(pot_pin);
motor_pwm = map(pot_read, 0, 4096, 0, 255);
analogWrite(motor_pin, motor_pwm);
delay(10); // this speeds up the simulation
}