]> git.piffa.net Git - sketchbook_andrea/blobdiff - RGB_LED/rgb_1_all_color/rgb_1_all_color.ino
multitasking
[sketchbook_andrea] / RGB_LED / rgb_1_all_color / rgb_1_all_color.ino
index 546d636e1ca44964aaa6d935ca3134f51c25fd61..b88d0da0476b1a7341462501e1dc4e991a509223 100644 (file)
@@ -1,53 +1,54 @@
-    /*
+/*
     Adafruit Arduino - Lesson 3. RGB LED
-    
-    RGB LED: rotazione tra tutti i colori.
-
-     Schema: http://lab.piffa.net/schemi/rgb.jpg
-
-    */
-     
-    int redPin = 11;
-    int greenPin = 10;
-    int bluePin = 9;
-     
-    //uncomment this line if using a Common Anode LED
-    //#define COMMON_ANODE
-     
-    void setup()
-    {
-    pinMode(redPin, OUTPUT);
-    pinMode(greenPin, OUTPUT);
-    pinMode(bluePin, OUTPUT);
-    }
-     
-    void loop()
-    {
-    setColor(255, 0, 0); // red
-    delay(1000);
-    setColor(0, 255, 0); // green
-    delay(1000);
-    setColor(0, 0, 255); // blue
-    delay(1000);
-    setColor(255, 255, 0); // yellow
-    delay(1000);
-    setColor(80, 0, 80); // purple
-    delay(1000);
-    setColor(0, 255, 255); // aqua
-    delay(1000);
-    }
-     
-    void setColor(int red, int green, int blue)
-    {
-    #ifdef COMMON_ANODE
-    red = 255 - red;
-    green = 255 - green;
-    blue = 255 - blue;
-    #endif
-    analogWrite(redPin, red);
-    analogWrite(greenPin, green);
-    analogWrite(bluePin, blue);
-    }
-    
-    
+ RGB LED: rotazione tra tutti i colori.
+ Schema: http://lab.piffa.net/schemi/rgb.jpg
+ */
+
+int redPin = 11;
+int greenPin = 10;
+int bluePin = 9;
+
+//uncomment this line if using a Common Anode LED
+//#define COMMON_ANODE
+
+void setup()
+{
+  pinMode(redPin, OUTPUT);
+  pinMode(greenPin, OUTPUT);
+  pinMode(bluePin, OUTPUT);
+}
+
+void loop()
+{
+  setColor(255, 0, 0); // red
+  delay(1000);
+  setColor(0, 255, 0); // green
+  delay(1000);
+  setColor(0, 0, 255); // blue
+  delay(1000);
+  setColor(255, 255, 0); // yellow
+  delay(1000);
+  setColor(80, 0, 80); // purple
+  delay(1000);
+  setColor(0, 255, 255); // aqua
+  delay(1000);
+}
+
+void setColor(int red, int green, int blue)
+{
+#ifdef COMMON_ANODE
+  red = 255 - red;
+  green = 255 - green;
+  blue = 255 - blue;
+#endif
+  analogWrite(redPin, red);
+  analogWrite(greenPin, green);
+  analogWrite(bluePin, blue);
+}
+
+
+