3 * Oggetti di uso comune
10 //////////////////////
14 RGBLed::RGBLed(byte pinR, byte pinG, byte pinB) {
19 // Equvalente del Setup() per inizializzare i PIN
20 pinMode(redPin, OUTPUT);
21 pinMode(greenPin, OUTPUT);
22 pinMode(greenPin, OUTPUT);
25 void RGBLed::SetColor (byte r, byte g, byte b) {
26 // Imposta il colore di un LED RGB
27 analogWrite(redPin, r);
28 analogWrite(greenPin, g);
29 analogWrite(bluePin, b);
33 // Accende il LED di rosso
37 void RGBLed::Green () {
38 // Accende il LED di verde
42 void RGBLed::Blue () {
43 // Accende il LED di blu
47 void RGBLed::Magenta () {
48 // Accende il LED di magenta
52 void RGBLed::Cyano () {
53 // Accende il LED di Cyano
57 void RGBLed::Yellow () {
58 // Accende il LED di giallo
62 void RGBLed::White () {
69 SetColor(255,255,255);
78 void brilla(byte pin, int velocita ) { // Defalt value di velocita' solo nell'Header
79 // Accende e spegne il LED accetando un argomento
80 // per impostare la velocita'.
83 // sequenze di istruzione: accendere e spegnere il LED
84 digitalWrite(pin, HIGH); // turn the LED on (HIGH is the voltage level)
85 delay(velocita); // wait for a second
86 digitalWrite(pin, LOW); // turn the LED off by making the voltage LOW
87 delay(velocita); // wait for a second