Skip to content

Instantly share code, notes, and snippets.

@SCI-COPATH
Created December 24, 2019 19:04
Show Gist options
  • Save SCI-COPATH/628d21de16854ec9a3e6031825e26fb6 to your computer and use it in GitHub Desktop.
Save SCI-COPATH/628d21de16854ec9a3e6031825e26fb6 to your computer and use it in GitHub Desktop.
#define pin 2
boolean value=0;
const int par=100;
void setup() {
pinMode(pin,INPUT);
Serial.begin(9600);
Serial.println("Sci-COPATH 1K Give Away counter");
}
void loop() {
value=digitalRead(pin);
if(value==1)
{
Serial.println("Start Counting");
delay(1000);
for(;;)
{
for(int i=1,value=0;i<=par;i++)
{
value=digitalRead(pin);
if(value==1)
{
Serial.print("Winner is token number ");
Serial.println(i);
for(;;);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment