// define the pins that each light uses // yellow1, yellow2, and red are the lights in the fireball // yellow2 and red MUST be and yellow1 should be connected to pins capable of PWM. // leftEye and right eye are the lights in the eyes and do not need to be connected to PWM but could be for fade type effects. #define yellow1 3 #define yellow2 5 #define red 6 #define leftEye 10 #define rightEye 12 void setup() { // put your setup code here, to run once: // setup the five pins that are used as outputs pinMode(yellow1, OUTPUT); pinMode(yellow2, OUTPUT); pinMode(red, OUTPUT); pinMode(leftEye, OUTPUT); pinMode(rightEye, OUTPUT); // set all pins to off to ensure that they are ready for the loop digitalWrite(yellow1, LOW); digitalWrite(yellow2, LOW); digitalWrite(red, LOW); digitalWrite(rightEye, LOW); digitalWrite(leftEye, LOW); // turn the eyes on. Also turn on one of the yellow lights. // one yellow light should remain on or the red light will overpower the yellow lights digitalWrite(rightEye, HIGH); digitalWrite(leftEye, HIGH); digitalWrite(yellow1, HIGH); } void loop() { // this repeats until you lose power or turn it off // pick a random number between 50%-100% for the flickering yellow light and turn it on to that "strength" analogWrite(yellow2, random(125, 254)); delay(100); // pick a random number between 0%-100% for the red light and turn it on to that strength analogWrite(red, random(0, 254)); delay(400); }