/* Jordan Bell, Code for LED's on Squid Lamp. Marquee pattern. Color changes. */ // Pin 13 has an LED connected on most Arduino boards. // give it a name: int red1 = 9; //pwm int red2 = 8; int red3 = 7; int green1 = 6; //pwm int green2 = 5; //pwm int green3 = 4; int blue1 = 3; //pwm int blue2 = 2; int blue3 = 10; //pwm int eyes = 11; //pwm int ontime1 = 150; int offtime1 = 10; int ontime2 = 150; int offtime2 = 10; int redcycles = 10; int greencycles = 10; int bluecyles = 10; int allcolorcycles = 60; int offtime = 3000; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(red1, OUTPUT); pinMode(red2, OUTPUT); pinMode(red3, OUTPUT); pinMode(green1, OUTPUT); pinMode(green2, OUTPUT); pinMode(green3, OUTPUT); pinMode(blue1, OUTPUT); pinMode(blue2, OUTPUT); pinMode(blue3, OUTPUT); pinMode(eyes, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(eyes, HIGH); for(int x = 0; x < redcycles; x++){ digitalWrite(red1, HIGH); // turn the LED on (HIGH is the voltage level) delay(ontime1); // wait for a second digitalWrite(red1, LOW); // turn the LED off by making the voltage LOW delay(offtime1); digitalWrite(red2, HIGH); // turn the LED on (HIGH is the voltage level) delay(ontime1); // wait for a second digitalWrite(red2, LOW); // turn the LED off by making the voltage LOW delay(offtime1); digitalWrite(red3, HIGH); // turn the LED on (HIGH is the voltage level) delay(ontime1); // wait for a second digitalWrite(red3, LOW); // turn the LED off by making the voltage LOW delay(offtime1); } for(int x = 0; x < greencycles; x++){ digitalWrite(green1, HIGH); // turn the LED on (HIGH is the voltage level) delay(ontime1); // wait for a second digitalWrite(green1, LOW); // turn the LED off by making the voltage LOW delay(offtime1); digitalWrite(green2, HIGH); // turn the LED on (HIGH is the voltage level) delay(ontime1); // wait for a second digitalWrite(green2, LOW); // turn the LED off by making the voltage LOW delay(offtime1); digitalWrite(green3, HIGH); // turn the LED on (HIGH is the voltage level) delay(ontime1); // wait for a second digitalWrite(green3, LOW); // turn the LED off by making the voltage LOW delay(offtime1); } for(int x = 0; x < bluecyles; x++){ digitalWrite(blue1, HIGH); // turn the LED on (HIGH is the voltage level) delay(ontime1); // wait for a second digitalWrite(blue1, LOW); // turn the LED off by making the voltage LOW delay(offtime1); digitalWrite(blue2, HIGH); // turn the LED on (HIGH is the voltage level) delay(ontime1); // wait for a second digitalWrite(blue2, LOW); // turn the LED off by making the voltage LOW delay(offtime1); digitalWrite(blue3, HIGH); // turn the LED on (HIGH is the voltage level) delay(ontime1); // wait for a second digitalWrite(blue3, LOW); // turn the LED off by making the voltage LOW delay(offtime1); } /////////////////////////////////////////////////////////////// /* digitalWrite(red1, HIGH); digitalWrite(green1, HIGH); digitalWrite(blue1, HIGH); // turn the LED on (HIGH is the voltage level) delay(ontime2); // wait for a second digitalWrite(red1, LOW); // turn the LED off by making the voltage LOW digitalWrite(green1, LOW); digitalWrite(blue1, LOW); delay(offtime2); digitalWrite(red2, HIGH); digitalWrite(green2, HIGH); digitalWrite(blue2, HIGH); // turn the LED on (HIGH is the voltage level) delay(ontime2); // wait for a second digitalWrite(red2, LOW); // turn the LED off by making the voltage LOW digitalWrite(green2, LOW); digitalWrite(blue2, LOW); delay(offtime2); digitalWrite(red3, HIGH); digitalWrite(green3, HIGH); digitalWrite(blue3, HIGH); // turn the LED on (HIGH is the voltage level) delay(ontime2); // wait for a second digitalWrite(red3, LOW); // turn the LED off by making the voltage LOW digitalWrite(green3, LOW); digitalWrite(blue3, LOW); delay(offtime2); */ //////////////////////////////////////////////////////////////// for(int x = 0; x < allcolorcycles; x++){ digitalWrite(red1, HIGH); digitalWrite(green2, HIGH); digitalWrite(blue3, HIGH); // turn the LED on (HIGH is the voltage level) delay(ontime2); // wait for a second digitalWrite(red1, LOW); // turn the LED off by making the voltage LOW digitalWrite(green2, LOW); digitalWrite(blue3, LOW); delay(offtime2); digitalWrite(red2, HIGH); digitalWrite(green3, HIGH); digitalWrite(blue1, HIGH); // turn the LED on (HIGH is the voltage level) delay(ontime2); // wait for a second digitalWrite(red2, LOW); // turn the LED off by making the voltage LOW digitalWrite(green3, LOW); digitalWrite(blue1, LOW); delay(offtime2); digitalWrite(red3, HIGH); digitalWrite(green1, HIGH); digitalWrite(blue2, HIGH); // turn the LED on (HIGH is the voltage level) delay(ontime2); // wait for a second digitalWrite(red3, LOW); // turn the LED off by making the voltage LOW digitalWrite(green1, LOW); digitalWrite(blue2, LOW); delay(offtime2); } delay(offtime); }