Silícios LabPCBWay
Published © GPL3+

Creating an Electronic Scoreboard with Arduino

You'll learn how to construct a scoreboard with Arduino.

BeginnerFull instructions provided30 minutes2,242
Creating an Electronic Scoreboard with Arduino

Things used in this project

Hardware components

PCBWay Custom PCB
PCBWay Custom PCB
×1
Arduino Nano R3
Arduino Nano R3
×1
Wire Jumpers - UTSOURCE
×1
10kR Resistor - UTSOURCE
×1
Switch Button - UTSOURCE
×1
TM1637 Module - UTSOURCE
×1
Arduino UNO - UTSOURCE
×1

Story

Read more

Schematics

Arduino Scoreboard - Electronic Schematic

Code

Arduino Scoreboard - Code

Arduino
#include <TM1637Display.h>

TM1637Display display(2,3);

byte CountP1 = 0, CountP2 = 0;
bool player1 = 0, player2 = 0;
bool PreviousStateP1 = 0, PreviousStateP2 = 0;

#define P1 6
#define P2 7

void setup()
{
       display.setBrightness(1);      // set display to maximum brightness
       
       pinMode(P1, INPUT);
       pinMode(P2, INPUT);

       display.showNumberDec(0,true,4,0);
}

void loop()
{
             player1 = digitalRead(P1); 
             player2 = digitalRead(P2);
             delay(50);
             
             if(player1 == 1 && PreviousStateP1 == 0)
             {
              CountP1++; 
              PreviousStateP1 = 1;
             }

             if(player1 == 0 && PreviousStateP1 == 1)
             {
              PreviousStateP1 = 0;
             }
             
             if(player2 == 1 && PreviousStateP2 == 0)
             {
              CountP2++; 
              PreviousStateP2 = 1;
             }

             if(player2 == 0 && PreviousStateP2 == 1)
             {
              PreviousStateP2 = 0;
             }             

               display.showNumberDecEx((100*CountP1) + CountP2, 0x40, 1, 4, 0);                           
}

Credits

Silícios Lab

Silícios Lab

60 projects • 125 followers
Hello, I'm Diego Moreira, founder of the Silícios LAB and I love program microcontrollers and works with electronic projects.
PCBWay

PCBWay

62 projects • 100 followers
We are a pcb prototype and assembly manufacturer to help creators build projects. As low as $5/10pcs and 3 days delivery time.

Comments