Codice da caricare su arduino:
int red=9,
green=10,
blue=11,
i=0,
j=0,
color[]={red, green, blue}, // since array counts start a 0, color[0]=9, color[1]=10, color[2]=11
intensity[]={0, 0,0}; // one intensity level for each color
void setup()
{
// set pins as outputs
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
pinMode(blue,OUTPUT);
// turn off all colors
analogWrite(red,0);
analogWrite(green,0);
analogWrite(blue,0);
}
void loop()
{
analogWrite(red,255); // turn on red
delay(1000); // wait a sec
analogWrite(red,0); // turn off red
analogWrite(green,255); // turn on green
delay(1000); // wait a sec
analogWrite(green,0); // turn off green
analogWrite(blue,255); // turn on blue
delay(1000); // wait a sec
analogWrite(blue,0); // turn off blue
}
Se avete dei problemi a far funzionare il circuito commentate o scrivete sul forum
Nessun commento:
Posta un commento
Commenta