28. { 29. if (digitalRead (redSwitchPin) LOW) 30. { 31. red ++; 32. if (red > 255) red = 0; 33. } 34. if (digitalRead (greenSwitchPin) == LOW) 35. { 36. green ++; if (green > 255) green = 0; 37. 38. }...


The fader circuit you built fades in each color. What instruction would you modify to
have the colors fade out?


28.<br>{<br>29.<br>if (digitalRead (redSwitchPin)<br>LOW)<br>30.<br>{<br>31.<br>red ++;<br>32.<br>if (red > 255) red = 0;<br>33.<br>}<br>34.<br>if (digitalRead (greenSwitchPin) == LOW)<br>35.<br>{<br>36.<br>green ++;<br>if (green > 255) green = 0;<br>37.<br>38.<br>}<br>39.<br>if (digitalRead (blueSwitchPin)<br>LOW)<br>40.<br>{<br>41.<br>blue ++;<br>42.<br>if (blue > 255) blue<br>= 0;<br>43.<br>}<br>44.<br>analogwrite(redLEDPin, red);<br>45.<br>analogwrite(greenLEDPin, green);<br>analogwrite (blueLEDPin, blue);<br>delay (10);<br>46.<br>47.<br>48.<br>}<br>

Extracted text: 28. { 29. if (digitalRead (redSwitchPin) LOW) 30. { 31. red ++; 32. if (red > 255) red = 0; 33. } 34. if (digitalRead (greenSwitchPin) == LOW) 35. { 36. green ++; if (green > 255) green = 0; 37. 38. } 39. if (digitalRead (blueSwitchPin) LOW) 40. { 41. blue ++; 42. if (blue > 255) blue = 0; 43. } 44. analogwrite(redLEDPin, red); 45. analogwrite(greenLEDPin, green); analogwrite (blueLEDPin, blue); delay (10); 46. 47. 48. }
1.<br>/*<br>2.<br>Adafruit Arduino -<br>Lesson 7. RGB Fader<br>3.<br>*/<br>4.<br>5.<br>int redLEDPin = 11;<br>int greenLEDPin<br>= 10;<br>int bluelEDPin = 9;<br>6.<br>7.<br>8.<br>9.<br>int redSwitchPin = 7;<br>int greenSwitchPin<br>= 6;<br>int blueSwitchPin = 5;<br>10.<br>11.<br>12.<br>13.<br>int red = 0;<br>14.<br>int blue = 0;<br>15.<br>int green = 0;<br>16.<br>17.<br>void setup()<br>18.<br>{<br>pinMode (redLEDPin, OUTPUT);<br>19.<br>pinMode(greenLEDPin, OUTPUT);<br>pinMode (blueLEDPin, OUTPUT);<br>pinMode (redSwitchPin, INPUT_PULLUP);<br>pinMode (greenSwitchPin, INPUT_PULLUP);<br>pinMode (bluesSwitchPin, INPUT_PULLUP);<br>20.<br>21.<br>22.<br>23.<br>24.<br>25.<br>}<br>26.<br>27.<br>void loop()<br>

Extracted text: 1. /* 2. Adafruit Arduino - Lesson 7. RGB Fader 3. */ 4. 5. int redLEDPin = 11; int greenLEDPin = 10; int bluelEDPin = 9; 6. 7. 8. 9. int redSwitchPin = 7; int greenSwitchPin = 6; int blueSwitchPin = 5; 10. 11. 12. 13. int red = 0; 14. int blue = 0; 15. int green = 0; 16. 17. void setup() 18. { pinMode (redLEDPin, OUTPUT); 19. pinMode(greenLEDPin, OUTPUT); pinMode (blueLEDPin, OUTPUT); pinMode (redSwitchPin, INPUT_PULLUP); pinMode (greenSwitchPin, INPUT_PULLUP); pinMode (bluesSwitchPin, INPUT_PULLUP); 20. 21. 22. 23. 24. 25. } 26. 27. void loop()

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here