Advertisement
diegocali86

Laboratorio Control de RGB por arduino

Jun 19th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. void setup()
  2. {
  3. for (int i =9 ; i<12 ; i++)
  4. pinMode(i, OUTPUT);
  5. }
  6.  
  7. void Color(int R, int G, int B)
  8. {
  9. analogWrite(9 , R) ; // Red - Rojo
  10. analogWrite(10, G) ; // Green - Verde
  11. analogWrite(11, B) ; // Blue - Azul
  12. }
  13.  
  14. void loop()
  15. { Color(255 ,0 ,0) ;
  16.  
  17. delay(500);
  18. Color(0,255 ,0) ;
  19. delay(500);
  20. Color(0 ,0 ,255) ;
  21. delay(500);
  22. Color(0,0,0);
  23. delay(1000);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement