Joseph AsfouriJanya RamJenna TakataVinay TummarakotaEvita Ngala
Published © GPL3+

Pandemic Party Ticker

An electronic counter for a small number of people, perhaps for a volunteer stationed at the entry to a party during a pandemic

BeginnerFull instructions provided2 hours412
Pandemic Party Ticker

Things used in this project

Hardware components

EK-TM4C123GXL TM4C Tiva LaunchPad
Texas Instruments EK-TM4C123GXL TM4C Tiva LaunchPad
×1
Seeed Studio Sidekick Basic Kit for TI LaunchPad
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Seeed Studio Tilt Switch
×1
Seeed Studio Breadboard BoosterPack
×1
Seeed Studio 7-segment Display
×1
Seeed Studio Button
×1

Software apps and online services

Energia
Texas Instruments Energia

Story

Read more

Schematics

Pandemic Party Ticker Wiring Diagram

Code

Pandemic Party Ticker Code

C/C++
//Defines the sequence of boolean sets to display hexadecimal values of variable ‘count’ on 7 segment display

byte seven_segment_digits[16][7] = { 
{ 0,0,0,0,0,0,1 }, // display '0'
                                { 1,0,0,1,1,1,1 },  // display '1'
                                { 0,0,1,0,0,1,0 },  // display '2'
                                { 0,0,0,0,1,1,0 },  // display '3'
                                { 1,0,0,1,1,0,0 },  // display '4'
                                { 0,1,0,0,1,0,0 },  // display '5'
                                { 0,1,0,0,0,0,0 },  // display '6'
                                { 0,0,0,1,1,1,1 },  // display '7'
                                { 0,0,0,0,0,0,0 },  // display '8'
                                { 0,0,0,1,1,0,0 },  // display'9'
                                { 0,0,0,1,0,0,0 },  // display 'A'
                                { 1,1,0,0,0,0,0 },  // display 'b'
                                { 0,1,1,0,0,0,1 },  // display 'C'
                                { 1,0,0,0,0,1,0 },  // display 'd'
                                { 0,1,1,0,0,0,0 },  // display 'E'
                                { 0,1,1,1,0,0,0 }   // display 'F'
                                   };

int count = 0; // initialize counter variable

void setup() {
  // Setup code which runs once

//Configures each pin connected to the 7-segment display as output

  pinMode(3, OUTPUT); // set segment A as output
  pinMode(4, OUTPUT); // set segment B as output
  pinMode(5, OUTPUT); // set segment C as output
  pinMode(6, OUTPUT); // set segment D as output
  pinMode(7, OUTPUT); // set segment E as output
  pinMode(8, OUTPUT); // set segment F as output
  pinMode(9, OUTPUT); // set segment G as output
  pinMode(10, OUTPUT); // set dot as output

// Configure pin connected to button switch 2 as input
  pinMode(11, INPUT); // set button switch as input

//Configure pin connected to tilt switch as input
 pinMode(tiltPin, INPUT);

  for(int i = 3; i < 10; i++) { // start with segments off
    digitalWrite(i, HIGH);
  }

  digitalWrite(10, HIGH);  // start with the dot off

//Sets pin 11 (onboard switch 2) to interrupt using function ‘increment’
 attachInterrupt(digitalPinToInterrupt(11), increment, RISING);
//Sets tiltPin (tilt switch) to interrupt using function ‘reset’
attachInterrupt(digitalPinToInterrupt(tiltPin), reset, RISING);  
}

void loop() {
//Function that displays the value of ‘count’ on the 7 segment display
  int pin = 3;
  for (int segCount = 0; segCount < 7; ++segCount) {
      digitalWrite(pin, seven_segment_digits[count][segCount]);
      ++pin;
    }

}

void increment(){
//Function that increments variable ‘count’ by 1
  if (count > 14)
    {
      count = 0;
    }
  else
    {
      count = count + 1;
    }
    delayMicroseconds(500000);
}

Credits

Joseph Asfouri
1 project • 1 follower
Janya Ram
1 project • 2 followers
Jenna Takata
1 project • 1 follower
Vinay Tummarakota
1 project • 1 follower
Evita Ngala
1 project • 1 follower

Comments