Advertisement
rabirajkhadka

LED Brightness Control Arduino

Aug 26th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. int LEDPIN=5;
  2. void setup() {
  3. pinmode(LEDPIN,OUTPUT);
  4. }
  5.  
  6. void loop() {
  7. for(int i=0;i<255;i++)
  8. {
  9. analogWrite(LEDPIN,i);
  10. delay(50);
  11. }
  12. delay(2000);
  13. for(int i=255;i>=0;i--)
  14. {
  15. analogWrite(LEDPIN,i);
  16. delay(50);
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement