daily pastebin goal
32%
SHARE
TWEET

motor PWM test

a guest Jan 29th, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void setup() {
  2.   pinMode(9,OUTPUT);
  3.   pinMode(10,OUTPUT);
  4.   digitalWrite(9,HIGH);
  5.   analogWrite(10,0);
  6. }
  7.  
  8. int val=0;
  9. int i=1;
  10.  
  11. void loop() {
  12.   delay(10);
  13.   analogWrite(10,val);
  14.   val+=i;
  15.   if(val>254) i=-1;
  16.   if(val<1) i=1;  
  17. }
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