#include <Simple5641AS.h>
#include "Button.h"
const uint8_t segmentPins[] = { 4, 6, 0, 10, 9, A0, 5, 13 };
const uint8_t digitSelectionPins[] = { A1, 11, 8, 7 };
Simple5641AS component( segmentPins, digitSelectionPins );
int ESDcount=0;
button reset(3);
bool display=2;
bool event=A2;
int time = 0;
void setup() {
Serial.begin(9600);
Serial.println("Program started!");
pinMode(2,INPUT);
pinMode(3,INPUT);
pinMode(A2,INPUT);
}
void loop() {
time = millis() - time;
while(time<=60000){
if(event=LOW){
ESDcount++;
component.displayNumber(2, ESDcount);
Serial.println("ESD events counted: "); Serial.print(ESDcount);
delay(1000);
}
else if(reset=HIGH){
ESDcount=0;
time = 0;
Serial.println("The ESD count has been rest to zero");
uint8_t animationCode[20] = {
B11001100, // r
B10011110, // e
B11011010, // s
B10011110, // e
B00011110 }; // t
int counter3 = 625;
int showChar = 0;
while (counter3 > 0) {
counter3--;
showChar = (625 - counter3) / 125;
component.customDisplayCycle(255, animationCode + showChar);
delay(3000);
}
}
else if(display=HIGH){
component.displayNumber(2, ESDcount);
Serial.println("ESD events counted: "); Serial.print(ESDcount);
delay(3000);
}
else{
component.displayNumber(2, ESDcount);
Serial.println("ESD events counted: "); Serial.print(ESDcount);
delay(2000);
}
time = millis() - time;
}
while (time>60000){
time = millis() - time;
if(event=LOW){
ESDcount++;
Serial.println("ESD events counted: "); Serial.print(ESDcount);
delay(1000);
}
else if(reset=HIGH){
ESDcount=0;
time = 0;
Serial.println("The ESD count has been rest to zero");
uint8_t animationCode[20] = {
B11001100, // r
B10011110, // e
B11011010, // s
B10011110, // e
B00011110 }; // t
int counter3 = 625;
int showChar = 0;
while (counter3 > 0) {
counter3--;
showChar = (625 - counter3) / 125;
component.customDisplayCycle(255, animationCode + showChar);
delay(3000);
}
}
else if(display=HIGH){
component.displayNumber(2, ESDcount);
Serial.println("ESD events counted: "); Serial.print(ESDcount);
delay(3000);
}
else{
Serial.println("ESD events counted: "); Serial.print(ESDcount);
delay(2000);
}
}
}