loading
this project embed an RGB led that changes colours  in a continous manner, an LCD which shows the current colour and the next one, or, in it's different mode, show you the intensity of the sorounding light, when there is enough.the power of the maximum light for the LED not to work can be calibrated easaly  throught a change of only one parameter in the code. (power)

You will need: 1. an arduino uno board
2. standard 16*2 LCD
3. common anode RGB LED
4. standard light sensor
5.10K & 330 ohm resistors

step 1. connect the rgb led anode to the uno GND
2. connect the red green & blue legs of the led through 330 ohm resistor to three of the PWM ports of uno
3. connect the light sensor from vcc to gnd through 10K resistor (so that the sensor is "up")
4. connect the second leg of the sensor to A5 analog input of uno.
5. connect the LCD (look at the code or change it for the position of connections-see file:///D:/My%20Documents/Arduino/arduino-1.0.1/reference/LiquidCrystalConstructor.html for reference)
6. after the adjosments of the code, compile and burn it to the UNO and your done :-)
there is a lot for creativity in replacing the light detector by almost every analog sensor... Enjoy!
the code: 


#include // for itoa() call
#include
LiquidCrystal lcd(7, 6, 2, 3, 4, 5);

void setup() {
lcd.begin(16,2);              // start the library 
lcd.setCursor(0,0);



void loop() {
  int power=150;
  
beg:analogWrite(11,0);
   analogWrite(10,0);
   analogWrite(9,0);

digitalWrite(8,HIGH);// providing ref V
  int a;
a=analogRead(A5);//read the value


char bufg[5];
// convert a to string [buf]
itoa(a,bufg, 10);
   lcd.print(itoa(a, bufg, 10));//print value
delay(1000);//delay
lcd.clear();// clear LCD for next iteration
  if (a>power) {goto beg;} else {goto next;}// check whether there is light
next:
int vec2[3]={random(255),random(130),random(30)};//random vec2
int vec1[3]={random(255),random(130),random(30)};//random vec1
int vec3[3]={234,100,20};//reff vector-random, but constant
int vec4[3]={random(255),random(130),random(30)};//random vec4
int vec5[3]={random(255),random(130),random(30)};//random vec5
int vec6[3]={random(255),random(130),random(30)};//random vec6

            int r=vec3[0];
            int g=vec3[1];
            int b=vec3[2];//initiation of the RGB to reff vec
while (1) {
    char bufr1[5];
// convert 123 to string [buf]
;
char bufg1[5];
// convert 123 to string [buf]
itoa(vec1[0], bufg1, 10);
char bufb1[5];
// convert 123 to string [buf]
itoa(vec1[1], bufb1, 10);
lcd.clear();
lcd.setCursor(0,1);
lcd.print ("R:");
   lcd.print(itoa(vec1[0], bufr1, 10));
   lcd.print (" G:");
   lcd.print(itoa(vec1[1], bufg1, 10));
   lcd.print (" B:");
   lcd.print(itoa(vec1[2], bufb1, 10));// prins the values of rgb led by usinf "itoa" function
                                 //itoa can convert an integer value to a string
                                delay(10);
         
           
   if (r>vec1[0]) {r--;} else
   if (r   
 

  
  
   if (g>vec1[1]) {g--;} else
   if (g
 
   if (b>vec1[2]) {b--;} else
   if (b   
   analogWrite(11,b);
   analogWrite(10,g);
   analogWrite(9,r); 
  char bufr[5];
// convert 123 to string [buf]
;
char bufg[5];
// convert 123 to string [buf]
itoa(g, bufg, 10);
char bufb[5];
// convert 123 to string [buf]
itoa(b, bufb, 10);
lcd.clear();
lcd.setCursor(0,0);
lcd.print ("R:");
   lcd.print(itoa(r, bufr, 10));
   lcd.print (" G:");
   lcd.print(itoa(g, bufg, 10));
   lcd.print (" B:");
   lcd.print(itoa(b, bufb, 10));// prins the values of rgb led by usinf "itoa" function
                                 //itoa can convert an integer value to a string 
   delay (10);
      if (r==vec1[0] && g==vec1[1] && b==vec1[2]) break;//this loop zooms the RGB integers to the target vector &output the change with delay 
                                                        //(repeats for all vectors one after the other)
digitalWrite(8,HIGH);// providing ref V
 
a=analogRead(A5);//read
  if (a>power) {analogWrite(11,0);
   analogWrite(10,0);
   analogWrite(9,0);

  goto beg;} 
}
           
while (1) {
  
    char bufr1[5];
// convert 123 to string [buf]
;
char bufg1[5];
// convert 123 to string [buf]
itoa(vec2[0], bufg1, 10);
char bufb1[5];
// convert 123 to string [buf]
itoa(vec2[1], bufb1, 10);
lcd.clear();
lcd.setCursor(0,1);
lcd.print ("R:");
   lcd.print(itoa(vec2[0], bufr1, 10));
   lcd.print (" G:");
   lcd.print(itoa(vec2[1], bufg1, 10));
   lcd.print (" B:");
   lcd.print(itoa(vec2[2], bufb1, 10));// prins the values of rgb led by usinf "itoa" function
                                 //itoa can convert an integer value to a string 
         
            delay(10);
   if (r>vec2[0]) {r--;} else
   if (r   
 

  
  
   if (g>vec2[1]) {g--;} else
   if (g
 
   if (b>vec2[2]) {b--;} else
   if (b   
   analogWrite(11,b);
   analogWrite(10,g);
   analogWrite(9,r); 
  
  char bufr[5];
// convert 123 to string [buf]
;
char bufg[5];
// convert 123 to string [buf]
itoa(g, bufg, 10);
char bufb[5];
// convert 123 to string [buf]
itoa(b, bufb, 10);
lcd.clear();
lcd.setCursor(0,0);
lcd.print ("R:");
   lcd.print(itoa(r, bufr, 10));
   lcd.print (" G:");
   lcd.print(itoa(g, bufg, 10));
   lcd.print (" B:");
   lcd.print(itoa(b, bufb, 10));// prins the values of rgb led by usinf "itoa" function
                                 //itoa can convert an integer vlue to a string 
 
   delay (10);
      if (r==vec2[0] && g==vec2[1] && b==vec2[2]) break;
digitalWrite(8,HIGH);// providing ref V
 
a=analogRead(A5);//read
  if (a>power) {analogWrite(11,0);
   analogWrite(10,0);
   analogWrite(9,0);

  goto beg;} 

  }
 
           
while (1) {
  
    char bufr1[5];
// convert 123 to string [buf]
;
char bufg1[5];
// convert 123 to string [buf]
itoa(vec4[0], bufg1, 10);
char bufb1[5];
// convert 123 to string [buf]
itoa(vec4[1], bufb1, 10);
lcd.clear();
lcd.setCursor(0,1);
lcd.print ("R:");
   lcd.print(itoa(vec4[0], bufr1, 10));
   lcd.print (" G:");
   lcd.print(itoa(vec4[1], bufg1, 10));
   lcd.print (" B:");
   lcd.print(itoa(vec4[2], bufb1, 10));// prins the values of rgb led by usinf "itoa" function
                                 //itoa can convert an integer value to a string 
          delay(10);
           
   if (r>vec4[0]) {r--;} else
   if (r   
 

  
  
   if (g>vec4[1]) {g--;} else
   if (g
 
   if (b>vec4[2]) {b--;} else
   if (b   
   analogWrite(11,b);
   analogWrite(10,g);
   analogWrite(9,r); 
  
  char bufr[5];
// convert 123 to string [buf]
;
char bufg[5];
// convert 123 to string [buf]
itoa(g, bufg, 10);
char bufb[5];
// convert 123 to string [buf]
itoa(b, bufb, 10);
lcd.clear();
lcd.setCursor(0,0);
lcd.print ("R:");
   lcd.print(itoa(r, bufr, 10));
   lcd.print (" G:");
   lcd.print(itoa(g, bufg, 10));
   lcd.print (" B:");
   lcd.print(itoa(b, bufb, 10));// prins the values of rgb led by usinf "itoa" function
                                 //itoa can convert an integer vlue to a string 
 
   delay (10);
      if (r==vec4[0] && g==vec4[1] && b==vec4[2]) break;
digitalWrite(8,HIGH);// providing ref V
 
a=analogRead(A5);//read
  if (a>power) {analogWrite(11,0);
   analogWrite(10,0);
   analogWrite(9,0);

  goto beg;} 

  }        
 
          
while (1) {
  
    char bufr1[5];
// convert 123 to string [buf]
;
char bufg1[5];
// convert 123 to string [buf]
itoa(vec5[0], bufg1, 10);
char bufb1[5];
// convert 123 to string [buf]
itoa(vec5[1], bufb1, 10);
lcd.clear();
lcd.setCursor(0,1);
lcd.print ("R:");
   lcd.print(itoa(vec5[0], bufr1, 10));
   lcd.print (" G:");
   lcd.print(itoa(vec5[1], bufg1, 10));
   lcd.print (" B:");
   lcd.print(itoa(vec5[2], bufb1, 10));// prins the values of rgb led by usinf "itoa" function
                                 //itoa can convert an integer value to a string 
         
            delay(10);
   if (r>vec5[0]) {r--;} else
   if (r   
 

  
  
   if (g>vec5[1]) {g--;} else
   if (g
 
   if (b>vec5[2]) {b--;} else
   if (b   
   analogWrite(11,b);
   analogWrite(10,g);
   analogWrite(9,r); 
  
  char bufr[5];
// convert 123 to string [buf]
;
char bufg[5];
// convert 123 to string [buf]
itoa(g, bufg, 10);
char bufb[5];
// convert 123 to string [buf]
itoa(b, bufb, 10);
lcd.clear();
lcd.setCursor(0,0);
lcd.print ("R:");
   lcd.print(itoa(r, bufr, 10));
   lcd.print (" G:");
   lcd.print(itoa(g, bufg, 10));
   lcd.print (" B:");
   lcd.print(itoa(b, bufb, 10));// prins the values of rgb led by usinf "itoa" function
                                 //itoa can convert an integer vlue to a string 
 
   delay (10);
      if (r==vec5[0] && g==vec5[1] && b==vec5[2]) break;
digitalWrite(8,HIGH);// providing ref V
 
a=analogRead(A5);//read
  if (a>power) {analogWrite(11,0);
   analogWrite(10,0);
   analogWrite(9,0);

  goto beg;} 

  }
          
while (1) {
  
    char bufr1[5];
// convert 123 to string [buf]
;
char bufg1[5];
// convert 123 to string [buf]
itoa(vec6[0], bufg1, 10);
char bufb1[5];
// convert 123 to string [buf]
itoa(vec6[1], bufb1, 10);
lcd.clear();
lcd.setCursor(0,1);
lcd.print ("R:");
   lcd.print(itoa(vec6[0], bufr1, 10));
   lcd.print (" G:");
   lcd.print(itoa(vec6[1], bufg1, 10));
   lcd.print (" B:");
   lcd.print(itoa(vec6[2], bufb1, 10));// prins the values of rgb led by usinf "itoa" function
                                 //itoa can convert an integer value to a string 
         
            delay(10);
   if (r>vec6[0]) {r--;} else
   if (r   
 

  
  
   if (g>vec6[1]) {g--;} else
   if (g
 
   if (b>vec6[2]) {b--;} else
   if (b   
   analogWrite(11,b);
   analogWrite(10,g);
   analogWrite(9,r); 
  
char bufr[5];
// convert 123 to string [buf]
;
char bufg[5];
// convert 123 to string [buf]
itoa(g, bufg, 10);
char bufb[5];
// convert 123 to string [buf]
itoa(b, bufb, 10);
lcd.clear();
lcd.setCursor(0,0);
lcd.print ("R:");
   lcd.print(itoa(r, bufr, 10));
   lcd.print (" G:");
   lcd.print(itoa(g, bufg, 10));
   lcd.print (" B:");
   lcd.print(itoa(b, bufb, 10));// prins the values of rgb led by usinf "itoa" function
                                 //itoa can convert an integer vlue to a string 
  
   delay (10);
      if (r==vec6[0] && g==vec6[1] && b==vec6[2]) break;
digitalWrite(8,HIGH);// providing ref V
 
a=analogRead(A5);//read
  if (a>power) {analogWrite(11,0);
   analogWrite(10,0);
   analogWrite(9,0);

  goto beg;} 
 
}


while (1) {
  
    char bufr1[5];
// convert 123 to string [buf]
;
char bufg1[5];
// convert 123 to string [buf]
itoa(vec3[0], bufg1, 10);
char bufb1[5];
// convert 123 to string [buf]
itoa(vec3[1], bufb1, 10);
lcd.clear();
lcd.setCursor(0,1);
lcd.print ("R:");
   lcd.print(itoa(vec3[0], bufr1, 10));
   lcd.print (" G:");
   lcd.print(itoa(vec3[1], bufg1, 10));
   lcd.print (" B:");
   lcd.print(itoa(vec3[2], bufb1, 10));// prins the values of rgb led by usinf "itoa" function
                                 //itoa can convert an integer value to a string 
         
            delay(10);
   if (r>vec3[0]) {r--;} else
   if (r   
 

  
  
   if (g>vec3[1]) {g--;} else
   if (g
 
   if (b>vec3[2]) {b--;} else
   if (b   
   analogWrite(11,b);
   analogWrite(10,g);
   analogWrite(9,r); 
  
  
  char bufr[5];
// convert 123 to string [buf]
;
char bufg[5];
// convert 123 to string [buf]
itoa(g, bufg, 10);
char bufb[5];
// convert 123 to string [buf]
itoa(b, bufb, 10);
lcd.clear();
lcd.setCursor(0,0);
lcd.print ("R:");
   lcd.print(itoa(r, bufr, 10));
   lcd.print (" G:");
   lcd.print(itoa(g, bufg, 10));
   lcd.print (" B:");
   lcd.print(itoa(b, bufb, 10));// prins the values of rgb led by usinf "itoa" function
                                 //itoa can convert an integer vlue to a string 
   delay (10);
      if (r==vec3[0] && g==vec3[1] && b==vec3[2]) break;//the last loop returns the RGB integers to the refference vector-this is critical
                                                       // so their won't be any "jumps" in colors
digitalWrite(8,HIGH);// providing ref V
 
a=analogRead(A5);//read
  if (a>power) {analogWrite(11,0);
   analogWrite(10,0);
   analogWrite(9,0);

  goto beg;} 

  }
goto next;
  }

please take notice that the original code was for an LCD shield that is not available and was purchased here:
 http://www.dan-e.co.il/index.php?route=common/home
also notice, that the program my contain uneeded parts and is builed "patch over patch" so there is some work to do if you want the code to be "clean" you my also use different ports at the uno, just don't forget to adjust the code for those changes.

good luck :-)
Dekel Ziv 
<p>can u show the schematic circuit</p>
OK weird... it won't copy so good, so see the attached file :-) <br> <br>sorry for that..
ignore the code, it is copied wrong. use this on: <br> <br> <br> <br>#include // for itoa() call <br>#include <br>LiquidCrystal lcd(7, 6, 2, 3, 4, 5); <br> <br>int lcd_key = 0; <br>int adc_key_in = 0; <br>#define btnRIGHT 0 <br>#define btnUP 1 <br>#define btnDOWN 2 <br>#define btnLEFT 3 <br>#define btnSELECT 4 <br>#define btnNONE 5 // read the buttons <br>int read_LCD_buttons() { <br> adc_key_in = analogRead(0); // read the value from the sensor <br> // my buttons when read are centered at thesevalies: 0, 144, 329, 504, 741 <br> // we add approx 50 to those values and check to see if we are close <br>if (adc_key_in &lt; 10)return btnNONE; <br>if ((adc_key_in &lt; 195)&amp;&amp; (adc_key_in&gt; 50))return btnRIGHT; <br>if ((adc_key_in &lt; 500)&amp;&amp; (adc_key_in &gt; 195))return btnUP; <br>if ((adc_key_in &lt; 700)&amp;&amp; (adc_key_in &gt;500))return btnDOWN; <br>if ((adc_key_in &lt; 900)&amp;&amp; (adc_key_in &gt;700))return btnLEFT; <br>if ((adc_key_in &lt; 1023)&amp;&amp; (adc_key_in &gt;900))return btnSELECT; <br>} <br>void setup() { <br> lcd.begin(16,2); // start the library <br>lcd.setCursor(0,0); <br> <br>} <br> <br>void loop() { <br> int power=150; <br> <br>beg:analogWrite(11,0); <br> analogWrite(10,0); <br> analogWrite(9,0); <br> <br>digitalWrite(8,HIGH);// providing ref V <br> int a; <br> a=analogRead(A5);//read the value <br> <br> <br>char bufg[5]; <br> // convert a to string [buf] <br> itoa(a,bufg, 10); <br> lcd.print(itoa(a, bufg, 10));//print value <br> delay(1000);//delay <br> lcd.clear();// clear LCD for next iteration <br> if (a&gt;power) {goto beg;} else {goto next;}// check whether there is light <br>next: <br>int vec2[3]={random(255),random(130),random(30)};//random vec2 <br>int vec1[3]={random(255),random(130),random(30)};//random vec1 <br>int vec3[3]={234,100,20};//reff vector-random, but constant <br>int vec4[3]={random(255),random(130),random(30)};//random vec4 <br>int vec5[3]={random(255),random(130),random(30)};//random vec5 <br>int vec6[3]={random(255),random(130),random(30)};//random vec6 <br> <br> int r=vec3[0]; <br> int g=vec3[1]; <br> int b=vec3[2];//initiation of the RGB to reff vec <br> while (1) { <br> char bufr1[5]; <br> // convert 123 to string [buf] <br> ; <br>char bufg1[5]; <br> // convert 123 to string [buf] <br> itoa(vec1[0], bufg1, 10); <br>char bufb1[5]; <br> // convert 123 to string [buf] <br> itoa(vec1[1], bufb1, 10); <br>lcd.clear(); <br>lcd.setCursor(0,1); <br>lcd.print (&quot;R:&quot;); <br> lcd.print(itoa(vec1[0], bufr1, 10)); <br> lcd.print (&quot; G:&quot;); <br> lcd.print(itoa(vec1[1], bufg1, 10)); <br> lcd.print (&quot; B:&quot;); <br> lcd.print(itoa(vec1[2], bufb1, 10));// prins the values of rgb led by usinf &quot;itoa&quot; function <br> //itoa can convert an integer value to a string <br> delay(10); <br> <br> <br> if (r&gt;vec1[0]) {r--;} else <br> if (r <br> <br> <br> <br> <br> if (g&gt;vec1[1]) {g--;} else <br> if (g <br> <br> if (b&gt;vec1[2]) {b--;} else <br> if (b <br> analogWrite(11,b); <br> analogWrite(10,g); <br> analogWrite(9,r); <br> char bufr[5]; <br> // convert 123 to string [buf] <br> ; <br>char bufg[5]; <br> // convert 123 to string [buf] <br> itoa(g, bufg, 10); <br>char bufb[5]; <br> // convert 123 to string [buf] <br> itoa(b, bufb, 10); <br>lcd.clear(); <br>lcd.setCursor(0,0); <br>lcd.print (&quot;R:&quot;); <br> lcd.print(itoa(r, bufr, 10)); <br> lcd.print (&quot; G:&quot;); <br> lcd.print(itoa(g, bufg, 10)); <br> lcd.print (&quot; B:&quot;); <br> lcd.print(itoa(b, bufb, 10));// prins the values of rgb led by usinf &quot;itoa&quot; function <br> //itoa can convert an integer value to a string <br> delay (10); <br> if (r==vec1[0] &amp;&amp; g==vec1[1] &amp;&amp; b==vec1[2]) break;//this loop zooms the RGB integers to the target vector &amp;output the change with delay <br> //(repeats for all vectors one after the other) <br> digitalWrite(8,HIGH);// providing ref V <br> <br> a=analogRead(A5);//read <br> if (a&gt;power) {analogWrite(11,0); <br> analogWrite(10,0); <br> analogWrite(9,0); <br> <br> goto beg;} <br>} <br> <br> while (1) { <br> <br> char bufr1[5]; <br> // convert 123 to string [buf] <br> ; <br>char bufg1[5]; <br> // convert 123 to string [buf] <br> itoa(vec2[0], bufg1, 10); <br>char bufb1[5]; <br> // convert 123 to string [buf] <br> itoa(vec2[1], bufb1, 10); <br>lcd.clear(); <br>lcd.setCursor(0,1); <br>lcd.print (&quot;R:&quot;); <br> lcd.print(itoa(vec2[0], bufr1, 10)); <br> lcd.print (&quot; G:&quot;); <br> lcd.print(itoa(vec2[1], bufg1, 10)); <br> lcd.print (&quot; B:&quot;); <br> lcd.print(itoa(vec2[2], bufb1, 10));// prins the values of rgb led by usinf &quot;itoa&quot; function <br> //itoa can convert an integer value to a string <br> <br> delay(10); <br> if (r&gt;vec2[0]) {r--;} else <br> if (r <br> <br> <br> <br> <br> if (g&gt;vec2[1]) {g--;} else <br> if (g <br> <br> if (b&gt;vec2[2]) {b--;} else <br> if (b <br> analogWrite(11,b); <br> analogWrite(10,g); <br> analogWrite(9,r); <br> <br> char bufr[5]; <br> // convert 123 to string [buf] <br> ; <br>char bufg[5]; <br> // convert 123 to string [buf] <br> itoa(g, bufg, 10); <br>char bufb[5]; <br> // convert 123 to string [buf] <br> itoa(b, bufb, 10); <br>lcd.clear(); <br>lcd.setCursor(0,0); <br>lcd.print (&quot;R:&quot;); <br> lcd.print(itoa(r, bufr, 10)); <br> lcd.print (&quot; G:&quot;); <br> lcd.print(itoa(g, bufg, 10)); <br> lcd.print (&quot; B:&quot;); <br> lcd.print(itoa(b, bufb, 10));// prins the values of rgb led by usinf &quot;itoa&quot; function <br> //itoa can convert an integer vlue to a string <br> <br> delay (10); <br> if (r==vec2[0] &amp;&amp; g==vec2[1] &amp;&amp; b==vec2[2]) break; <br> digitalWrite(8,HIGH);// providing ref V <br> <br> a=analogRead(A5);//read <br> if (a&gt;power) {analogWrite(11,0); <br> analogWrite(10,0); <br> analogWrite(9,0); <br> <br> goto beg;} <br> <br> } <br> <br> <br> while (1) { <br> <br> char bufr1[5]; <br> // convert 123 to string [buf] <br> ; <br>char bufg1[5]; <br> // convert 123 to string [buf] <br> itoa(vec4[0], bufg1, 10); <br>char bufb1[5]; <br> // convert 123 to string [buf] <br> itoa(vec4[1], bufb1, 10); <br>lcd.clear(); <br>lcd.setCursor(0,1); <br>lcd.print (&quot;R:&quot;); <br> lcd.print(itoa(vec4[0], bufr1, 10)); <br> lcd.print (&quot; G:&quot;); <br> lcd.print(itoa(vec4[1], bufg1, 10)); <br> lcd.print (&quot; B:&quot;); <br> lcd.print(itoa(vec4[2], bufb1, 10));// prins the values of rgb led by usinf &quot;itoa&quot; function <br> //itoa can convert an integer value to a string <br> delay(10); <br> <br> if (r&gt;vec4[0]) {r--;} else <br> if (r <br> <br> <br> <br> <br> if (g&gt;vec4[1]) {g--;} else <br> if (g <br> <br> if (b&gt;vec4[2]) {b--;} else <br> if (b <br> analogWrite(11,b); <br> analogWrite(10,g); <br> analogWrite(9,r); <br> <br> char bufr[5]; <br> // convert 123 to string [buf] <br> ; <br>char bufg[5]; <br> // convert 123 to string [buf] <br> itoa(g, bufg, 10); <br>char bufb[5]; <br> // convert 123 to string [buf] <br> itoa(b, bufb, 10); <br>lcd.clear(); <br>lcd.setCursor(0,0); <br>lcd.print (&quot;R:&quot;); <br> lcd.print(itoa(r, bufr, 10)); <br> lcd.print (&quot; G:&quot;); <br> lcd.print(itoa(g, bufg, 10)); <br> lcd.print (&quot; B:&quot;); <br> lcd.print(itoa(b, bufb, 10));// prins the values of rgb led by usinf &quot;itoa&quot; function <br> //itoa can convert an integer vlue to a string <br> <br> delay (10); <br> if (r==vec4[0] &amp;&amp; g==vec4[1] &amp;&amp; b==vec4[2]) break; <br>digitalWrite(8,HIGH);// providing ref V <br> <br> a=analogRead(A5);//read <br> if (a&gt;power) {analogWrite(11,0); <br> analogWrite(10,0); <br> analogWrite(9,0); <br> <br> goto beg;} <br> <br> } <br> <br> <br> while (1) { <br> <br> char bufr1[5]; <br> // convert 123 to string [buf] <br> ; <br>char bufg1[5]; <br> // convert 123 to string [buf] <br> itoa(vec5[0], bufg1, 10); <br>char bufb1[5]; <br> // convert 123 to string [buf] <br> itoa(vec5[1], bufb1, 10); <br>lcd.clear(); <br>lcd.setCursor(0,1); <br>lcd.print (&quot;R:&quot;); <br> lcd.print(itoa(vec5[0], bufr1, 10)); <br> lcd.print (&quot; G:&quot;); <br> lcd.print(itoa(vec5[1], bufg1, 10)); <br> lcd.print (&quot; B:&quot;); <br> lcd.print(itoa(vec5[2], bufb1, 10));// prins the values of rgb led by usinf &quot;itoa&quot; function <br> //itoa can convert an integer value to a string <br> <br> delay(10); <br> if (r&gt;vec5[0]) {r--;} else <br> if (r <br> <br> <br> <br> <br> if (g&gt;vec5[1]) {g--;} else <br> if (g <br> <br> if (b&gt;vec5[2]) {b--;} else <br> if (b <br> analogWrite(11,b); <br> analogWrite(10,g); <br> analogWrite(9,r); <br> <br> char bufr[5]; <br> // convert 123 to string [buf] <br> ; <br>char bufg[5]; <br> // convert 123 to string [buf] <br> itoa(g, bufg, 10); <br>char bufb[5]; <br> // convert 123 to string [buf] <br> itoa(b, bufb, 10); <br>lcd.clear(); <br>lcd.setCursor(0,0); <br>lcd.print (&quot;R:&quot;); <br> lcd.print(itoa(r, bufr, 10)); <br> lcd.print (&quot; G:&quot;); <br> lcd.print(itoa(g, bufg, 10)); <br> lcd.print (&quot; B:&quot;); <br> lcd.print(itoa(b, bufb, 10));// prins the values of rgb led by usinf &quot;itoa&quot; function <br> //itoa can convert an integer vlue to a string <br> <br> delay (10); <br> if (r==vec5[0] &amp;&amp; g==vec5[1] &amp;&amp; b==vec5[2]) break; <br> digitalWrite(8,HIGH);// providing ref V <br> <br> a=analogRead(A5);//read <br> if (a&gt;power) {analogWrite(11,0); <br> analogWrite(10,0); <br> analogWrite(9,0); <br> <br> goto beg;} <br> <br> } <br> <br> while (1) { <br> <br> char bufr1[5]; <br> // convert 123 to string [buf] <br> ; <br>char bufg1[5]; <br> // convert 123 to string [buf] <br> itoa(vec6[0], bufg1, 10); <br>char bufb1[5]; <br> // convert 123 to string [buf] <br> itoa(vec6[1], bufb1, 10); <br>lcd.clear(); <br>lcd.setCursor(0,1); <br>lcd.print (&quot;R:&quot;); <br> lcd.print(itoa(vec6[0], bufr1, 10)); <br> lcd.print (&quot; G:&quot;); <br> lcd.print(itoa(vec6[1], bufg1, 10)); <br> lcd.print (&quot; B:&quot;); <br> lcd.print(itoa(vec6[2], bufb1, 10));// prins the values of rgb led by usinf &quot;itoa&quot; function <br> //itoa can convert an integer value to a string <br> <br> delay(10); <br> if (r&gt;vec6[0]) {r--;} else <br> if (r <br> <br> <br> <br> <br> if (g&gt;vec6[1]) {g--;} else <br> if (g <br> <br> if (b&gt;vec6[2]) {b--;} else <br> if (b <br> analogWrite(11,b); <br> analogWrite(10,g); <br> analogWrite(9,r); <br> <br> char bufr[5]; <br> // convert 123 to string [buf] <br> ; <br>char bufg[5]; <br> // convert 123 to string [buf] <br> itoa(g, bufg, 10); <br>char bufb[5]; <br> // convert 123 to string [buf] <br> itoa(b, bufb, 10); <br>lcd.clear(); <br>lcd.setCursor(0,0); <br>lcd.print (&quot;R:&quot;); <br> lcd.print(itoa(r, bufr, 10)); <br> lcd.print (&quot; G:&quot;); <br> lcd.print(itoa(g, bufg, 10)); <br> lcd.print (&quot; B:&quot;); <br> lcd.print(itoa(b, bufb, 10));// prins the values of rgb led by usinf &quot;itoa&quot; function <br> //itoa can convert an integer vlue to a string <br> <br> delay (10); <br> if (r==vec6[0] &amp;&amp; g==vec6[1] &amp;&amp; b==vec6[2]) break; <br>digitalWrite(8,HIGH);// providing ref V <br> <br> a=analogRead(A5);//read <br> if (a&gt;power) {analogWrite(11,0); <br> analogWrite(10,0); <br> analogWrite(9,0); <br> <br> goto beg;} <br> <br>} <br> <br> <br> while (1) { <br> <br> char bufr1[5]; <br> // convert 123 to string [buf] <br> ; <br>char bufg1[5]; <br> // convert 123 to string [buf] <br> itoa(vec3[0], bufg1, 10); <br>char bufb1[5]; <br> // convert 123 to string [buf] <br> itoa(vec3[1], bufb1, 10); <br>lcd.clear(); <br>lcd.setCursor(0,1); <br>lcd.print (&quot;R:&quot;); <br> lcd.print(itoa(vec3[0], bufr1, 10)); <br> lcd.print (&quot; G:&quot;); <br> lcd.print(itoa(vec3[1], bufg1, 10)); <br> lcd.print (&quot; B:&quot;); <br> lcd.print(itoa(vec3[2], bufb1, 10));// prins the values of rgb led by usinf &quot;itoa&quot; function <br> //itoa can convert an integer value to a string <br> <br> delay(10); <br> if (r&gt;vec3[0]) {r--;} else <br> if (r <br> <br> <br> <br> <br> if (g&gt;vec3[1]) {g--;} else <br> if (g <br> <br> if (b&gt;vec3[2]) {b--;} else <br> if (b <br> analogWrite(11,b); <br> analogWrite(10,g); <br> analogWrite(9,r); <br> <br> <br> char bufr[5]; <br> // convert 123 to string [buf] <br> ; <br>char bufg[5]; <br> // convert 123 to string [buf] <br> itoa(g, bufg, 10); <br>char bufb[5]; <br> // convert 123 to string [buf] <br> itoa(b, bufb, 10); <br>lcd.clear(); <br>lcd.setCursor(0,0); <br>lcd.print (&quot;R:&quot;); <br> lcd.print(itoa(r, bufr, 10)); <br> lcd.print (&quot; G:&quot;); <br> lcd.print(itoa(g, bufg, 10)); <br> lcd.print (&quot; B:&quot;); <br> lcd.print(itoa(b, bufb, 10));// prins the values of rgb led by usinf &quot;itoa&quot; function <br> //itoa can convert an integer vlue to a string <br> delay (10); <br> if (r==vec3[0] &amp;&amp; g==vec3[1] &amp;&amp; b==vec3[2]) break;//the last loop returns the RGB integers to the refference vector-this is critical <br> // so their won't be any &quot;jumps&quot; in colors <br>digitalWrite(8,HIGH);// providing ref V <br> <br> a=analogRead(A5);//read <br> if (a&gt;power) {analogWrite(11,0); <br> analogWrite(10,0); <br> analogWrite(9,0); <br> <br> goto beg;} <br> <br> } <br>goto next; <br> } <br> <br>
I'm sorry for the (very) messy instructions, just getting to know this site &amp; how to use it... anyway, if you have any questions, please feel free to ask me &amp; if i'd know the answer i will tell you. good luck!

About This Instructable

2,252views

9favorites

License:

More by Dekel Ziv:RGB LED change of colours+light sensor+LCD 
Add instructable to: