Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int motorPin=3;
- void setup() {
- pinMode(motorPin, OUTPUT);
- Serial.begin (9600);
- while (! Serial);
- Serial.println("Speed 0 to 10");
- }
- void loop()
- {
- if (Serial.available ())
- {
- int speed= Serial.parseInt();
- if (speed >= 0 && speed <= 250)
- {
- analogWrite(motorPin, speed);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement