How can I reset the score after the results to 0 - 0?

#include <LiquidCrystal.h>

LiquidCrystal
lcd(12,11,5,4,3,2);

char candidate_1='A';
char candidate_2='B';
int vote_1=0;
int vote_2=0;

int state_1=0;
int state_2=0;
int result=0;

int button_1=6;
int button_2=7;
int button_result=8;

//Display message
void first_display() {
lcd.setCursor(0,0);
lcd.print("1-");
lcd.print(candidate_1);

lcd.setCursor(0,1);

lcd.print("2-");
lcd.print(candidate_2);

lcd.print(" choose!");

}

void setup() {
Serial.begin(9600);
lcd.begin(16,2);
pinMode(button_1,INPUT);
pinMode(button_2,INPUT);
pinMode(button_result,INPUT);

}

void loop() {

first_display();

state_1= digitalRead(button_1);
state_2=digitalRead(button_2);
result=digitalRead(button_result);

if(state_1==HIGH) {
vote_1++;
lcd.clear();
delay(1000);
lcd.print(candidate_1);
lcd.print(" selected");
Serial.print(candidate_1);
Serial.print(" selected");

delay(2000);
lcd.clear();

}

if(state_2==HIGH) {
vote_2++;
lcd.clear();
delay(1000);
lcd.print(candidate_2);
lcd.print(" selected");

Serial.print(candidate_2);
Serial.print("    selected");

delay(2000);
lcd.clear();

}

if(result==HIGH) {
lcd.clear();
delay(1000);
lcd.print(candidate_1);
lcd.print(" ");
lcd.print(vote_1);

  Serial.print("    ");
  Serial.print(vote_1);
  
  lcd.setCursor(0,1); 

  lcd.print(candidate_2);
  lcd.print("    ");
  lcd.print(vote_2);

  Serial.print("    ");
  Serial.print(vote_2);
  
  delay(4000);
  lcd.clear();

}

}

Can you supply a bit more information relating to your question?
Paul

The easier you make it to read and copy your code the more likely it is that you will get help

Please follow the advice given in the link below when posting code , use code tags and post the code here

If you get errors when compiling please copy them from the IDE using the "Copy error messages" button and paste the clipboard here in code tags

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.