Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. int red_light_pin= 11;
  2. int green_light_pin = 10;
  3. int blue_light_pin = 9;
  4. void setup() {
  5. pinMode(red_light_pin, OUTPUT);
  6. pinMode(green_light_pin, OUTPUT);
  7. pinMode(blue_light_pin, OUTPUT);
  8. }
  9. void loop() {
  10. RGB_color(255, 0, 0); // Red
  11. delay(1000);
  12. RGB_color(0, 255, 0); // Green
  13. delay(1000);
  14. RGB_color(0, 0, 255); // Blue
  15. delay(1000);
  16. RGB_color(255, 255, 125); // Raspberry
  17. delay(1000);
  18. RGB_color(0, 255, 255); // Cyan
  19. delay(1000);
  20. RGB_color(255, 0, 255); // Magenta
  21. delay(1000);
  22. RGB_color(255, 255, 0); // Yellow
  23. delay(1000);
  24. RGB_color(255, 255, 255); // White
  25. delay(1000);
  26. }
  27. void RGB_color(int red_light_value, int green_light_value, int blue_light_value)
  28. {
  29. analogWrite(red_light_pin, red_light_value);
  30. analogWrite(green_light_pin, green_light_value);
  31. analogWrite(blue_light_pin, blue_light_value);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement