Advertisement
OlivierArgentieri

Untitled

Jan 14th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.79 KB | None | 0 0
  1. const int R = 1;
  2. const int V = 1;  
  3. const int B = 1;  
  4.  
  5. const int Bleu = 11;
  6. const int Rouge = 10;
  7. const int Vert = 9;
  8.  
  9.  
  10. const int VertBouton = 8;
  11. const int OrangeBouton = 7;
  12.  
  13. void setup() {
  14. pinMode (Vert,OUTPUT);
  15. pinMode (Rouge,OUTPUT);
  16. pinMode (Bleu,OUTPUT);
  17.  
  18.  
  19. pinMode(VertBouton, INPUT_PULLUP);
  20. pinMode(OrangeBouton, INPUT_PULLUP);
  21.  
  22. Serial.begin(11500);
  23. }
  24.  
  25. void loop() {
  26.  
  27.   if((digitalRead(OrangeBouton) == LOW))
  28.   {
  29.     ledRVBpwm(235,40,10); // Orange
  30.   }
  31.   else if ((digitalRead(VertBouton) == LOW))
  32.   {
  33.     ledRVBpwm(70,243,20); // Vert
  34.   }
  35.   else
  36.   {
  37.       ledRVBpwm(0,0,0);
  38.   }
  39.  
  40.  
  41. }
  42.  
  43.  
  44.  
  45. void ledRVBpwm(int pwmRouge, int pwmVert, int pwmBleu) //  0-255 par couleur
  46. {
  47. analogWrite(Rouge, pwmRouge);
  48. analogWrite(Vert, pwmVert);
  49. analogWrite(Bleu, pwmBleu);
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement