Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #define PR A0 n puerto analogo (A0)
  2. #define PG A1
  3. #define PB A2
  4. int rojo = 11;
  5. int verde = 10;
  6. int azul = 9;
  7.  
  8.  
  9. void setup ()
  10. {
  11.  
  12.   pinMode (rojo, OUTPUT);
  13.   pinMode (verde, OUTPUT);
  14.   pinMode (azul, OUTPUT);
  15.  
  16.   pinMode (PR, INPUT);
  17.   pinMode (PG, INPUT);
  18.   pinMode (PB, INPUT);
  19.   Serial.begin (9600);
  20. }
  21.  
  22. void loop ()
  23. {
  24.   int R = analogRead(PR);
  25.   int i = map(R,0,1023,0,255);
  26.  
  27.   int G = analogRead(PG);
  28.   int i1 = map(G,0,1023,0,255);
  29.  
  30.   int B = analogRead(PB);
  31.   int i2 = map(B,0,1023,0,255);
  32.  
  33.   analogWrite (azul,i2);
  34.   analogWrite (rojo,i);
  35.   analogWrite (verde,i1);
  36.  
  37.  }