Oscar
Published © GPL3+

World Cup Goal Light Display

Let your living room light up as a goal is scored during the World Cup.

IntermediateFull instructions provided2 hours230

Things used in this project

Hardware components

Male/Female Jumper Wires
Male/Female Jumper Wires
×48
Male/Male Jumper Wires
13-14 required 2-3 optional
×16
Breadboard (generic)
Breadboard (generic)
×2
Photon
Particle Photon
×1
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
Optional
×1
LED (generic)
LED (generic)
Your choice of colors
×24
Cable Ties (10 Pack)
OpenBuilds Cable Ties (10 Pack)
×2
Resistor 330 ohm
Resistor 330 ohm
×5
Resistor 10 ohm
×7
Amazon C1 Cardboard Book Wrap
×1

Software apps and online services

Twitter service
IFTTT Twitter service

Hand tools and fabrication machines

5mm Power Drill
Tweezers

Story

Read more

Schematics

Photon and LEDs

Particleandled oqnwa5ikmy

Only Photon

Particleonly zbkttxhldn

Only LEDs

Onlyled bb e1spkdr36t

Code

Light Display Code

C/C++
/* Map the pins to LEDs */

/* You may have to adjust/swap the pin values to match 
how you have connected/placed the LEDs on the cardboard*/

int ledWhite1 = A4;
int ledWhite2 = A5;
int ledYellow1 = A3;
int ledYellow2 = A2;
int ledYellow3 = A1;
int ledYellow4 = D2;
int ledYellow5 = D3;
int ledBlue1= D4;
int ledBlue2 = D5;
int ledBlue3 = D6;
int ledBlue4 = D7;
int ledBlue5 = D1;

/* Map the push button pin */
int pushButton = D0;

/* Instantiate what will be the light function */
int goalLight(String command);

/* Run set up pins, button, and function */
void setup() {
    pinMode(ledWhite1, OUTPUT);
    pinMode(ledWhite2, OUTPUT);
    pinMode(ledYellow1, OUTPUT);
    pinMode(ledYellow2, OUTPUT);
    pinMode(ledYellow3, OUTPUT);
    pinMode(ledYellow4, OUTPUT);
    pinMode(ledYellow5, OUTPUT);
    pinMode(ledBlue1, OUTPUT);
    pinMode(ledBlue2, OUTPUT);
    pinMode(ledBlue3, OUTPUT);
    pinMode(ledBlue4, OUTPUT);
    pinMode(ledBlue5, OUTPUT);
    pinMode(pushButton, INPUT_PULLUP);
    Particle.function("goalLight", goalLight);  //This will make the function "goalLight" accessible from the cloud
}

/*A loop which allows us to trigger the light display using the button.
The content of the loop isn't need if you don't install a push button. */
void loop() {
    int pushButtonState;
    pushButtonState = digitalRead(pushButton);
    
    if(pushButtonState == LOW){
        blinkLoop();
        delay(1000);    //Wait one second
    }
}

/* The cloud triggered function */
int goalLight(String command)
{
    if(command == "score"){
        blinkLoop();
        return 1;
    }
    else return -1;
}

/* The function which triggers the LEDs.
Edit to suit your needs. */
void blinkLoop(){
            for (int i = 0; i<5; i++){
            digitalWrite(ledWhite1, HIGH);
            delay(150);
            digitalWrite(ledWhite1, LOW);
            
            digitalWrite(ledBlue1, HIGH);
            delay(150);
            digitalWrite(ledBlue1, LOW);
            
            digitalWrite(ledYellow1, HIGH);
            delay(150);
            digitalWrite(ledYellow1, LOW);
            
            digitalWrite(ledBlue2, HIGH);
            delay(150);
            digitalWrite(ledBlue2, LOW);
            
            digitalWrite(ledYellow2, HIGH);
            delay(150);
            digitalWrite(ledYellow2, LOW);

            digitalWrite(ledBlue3, HIGH);
            delay(150);
            digitalWrite(ledBlue3, LOW);
            
            digitalWrite(ledYellow3, HIGH);
            delay(150);
            digitalWrite(ledYellow3, LOW);
            
            digitalWrite(ledWhite2, HIGH);
            delay(150);
            digitalWrite(ledWhite2, LOW);
            
            digitalWrite(ledBlue4, HIGH);
            delay(150);
            digitalWrite(ledBlue4, LOW);
            
            digitalWrite(ledYellow4, HIGH);
            delay(150);
            digitalWrite(ledYellow4, LOW);
            
            digitalWrite(ledBlue5, HIGH);
            delay(150);
            digitalWrite(ledBlue5, LOW);
            
            digitalWrite(ledYellow5, HIGH);
            delay(150);
            digitalWrite(ledYellow5, LOW);
        }
}

Credits

Oscar

Oscar

1 project • 0 followers
Tinkering on evenings and weekends, mostly Particle Photon stuff.

Comments

Add projectSign up / Login