Silícios LabPCBWay
Published © GPL3+

Creating an Electronic Scoreboard with Arduino

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

BeginnerFull instructions provided30 minutes13,848
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

71 projects • 173 followers
Hello, I love program microcontrollers and works with electronic projects.
PCBWay

PCBWay

89 projects • 146 followers
We are a PCB and assembly manufacturer, As low as $5/10pcs and 24 hours delivery time. We are committed to helping creators build project.

Comments