#include <EEPROM.h>
#define ClearEEPROMPin 2
unsigned long PreviousEEPROMMillis = 0;
int count = 0;



void setup() {
  Serial.begin(115200);// put your setup code here, to run once:
pinMode(2, INPUT_PULLUP);

}

void loop() {
 ClearEEPROM();
}
void LED(){

}

void ClearEEPROM(){                                                         // When the reset button is held for 3 seconds, clear the coin counter
	if (digitalRead (ClearEEPROMPin) == 0){	
		unsigned long CurrentMillis = millis();
		if (CurrentMillis - PreviousEEPROMMillis >= 1000){	                    // Start counting by seconds when the button is first pressed				
      PreviousEEPROMMillis = CurrentMillis;
      count++; Serial.println(count);
        if (count == 3) { 
          EEPROM.put(0,0);                                                      // If the count reaches 3 seconds, then clear the eeprom
          //ReadSoundBits(CoinReset, sizeof(CoinReset), SoundModOut_1);
          Serial.println("EEPROM cleared");
          count = 0;
        }                   
		}
	}
  else {  //if (digitalRead(ClearEEPROMPin) == 1){                              // If pressed for fewer than 3 seconds, reset the count to zero and take no action
              count = 0;
              //Serial.print("count = ");
              Serial.println(count);
   }
}