daily pastebin goal
64%
SHARE
TWEET

Untitled

a guest Dec 20th, 2016 159 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int motorPin = 3;
  2.  
  3. void setup()
  4. {
  5.   pinMode(motorPin, OUTPUT);
  6.   Serial.begin(9600);
  7.   while (! Serial);
  8.   Serial.println("Speed 0 to 255");
  9. }
  10.  
  11.  
  12. void loop()
  13. {
  14.   if (Serial.available())
  15.   {
  16.     int speed = Serial.parseInt();
  17.     if (speed >= 0 && speed <= 255)
  18.     {
  19.       analogWrite(motorPin, speed);
  20.     }
  21.   }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top