Created
March 28, 2018 03:08
-
-
Save m4rk3r/b41a9c6b8710c87f3fa353cd9666278c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int pos = 155; | |
int M = 255; | |
int m = 155; | |
int dir = 1; | |
void setup(){ | |
pinMode(9,OUTPUT); | |
Serial.begin(9600); | |
} | |
void loop(){ | |
//if(pos%10==0) | |
analogWrite(9,pos); | |
delay(20); | |
pos += 1 * dir; | |
if(pos>=M) | |
dir = -1; | |
else if(pos <= m) | |
dir = 1; | |
Serial.println(pos); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment