Advertisement
jpglickwebber

LED fading

Feb 21st, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. 1.
  2. void setup() {
  3. pinMode(9, OUTPUT);
  4. for(int j=0; j<7; j++){
  5. for(int i=255; i>=0; i--){
  6. analogWrite(9, i);
  7. delay(30);
  8. }
  9. }
  10. }
  11.  
  12. void loop() {
  13. // put your main code here, to run repeatedly:
  14.  
  15. }
  16.  
  17. 2.
  18. void setup() {
  19. for(int i=255; i>=0; i--){
  20. analogWrite(9, i);
  21. tone(2, i+500, 30);
  22. delay(30);
  23. }
  24. for(int i=0; i<=255; i++){
  25. analogWrite(9, i);
  26. tone(2, i+500, 30);
  27. delay(30);
  28. }
  29. }
  30.  
  31. void loop() {
  32. // put your main code here, to run repeatedly:
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement