IR Remote and LCD Display

Ive been using Arduino for a technology class my high school provides. Im fairly new too Arduino and programming in general. Im trying to program the IR Remote to send the signals to the LCD display and display baseball home and away scores. The goal is that when I press the VOL+ button, it adds 1 to the home score, and when the VOL- is press, it does the same to the away team. So far, the code adds one point to both teams. the other problem is that it happens when any button is pressed. If I could receive some outside help from someone who knows Arduino, that would be very helpful.

sketch_may08b.ino (2.46 KB)

Please post your code, and describe what it does that you don't expect, and what it doesn't do that you do expect.

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
#include <IRremote.h>
#include <IRremoteInt.h>

#include "IRremote.h"

int receiver = 13; // Signal Pin of IR receiver to Arduino Digital Pin 11

IRrecv irrecv(receiver);
decode_results results;

int awayScoreflag = 1;
int HomeScoreflag = 1;
int awayScore = 0;
int homeScore = 0;
void translateIR()
{

switch(results.value)

{
case 0xFFA25D: Serial.println("POWER"); break;
case 0xFFE21D: Serial.println("FUNC/STOP"); break;
case 0xFF629D: HomeScoreflag = 1; break; //Serial.println("VOL+"); break;
case 0xFF22DD: Serial.println("FAST BACK"); break;
case 0xFF02FD: Serial.println("PAUSE"); break;
case 0xFFC23D: Serial.println("FAST FORWARD"); break;
case 0xFFE01F: Serial.println("DOWN"); break;
case 0xFFA857: awayScoreflag = 1; break; //Serial.println("VOL-"); break;
case 0xFF906F: Serial.println("UP"); break;
case 0xFF9867: Serial.println("EQ"); break;
case 0xFFB04F: Serial.println("ST/REPT"); break;
case 0xFF6897: Serial.println("0"); break;
case 0xFF30CF: Serial.println("1"); break;
case 0xFF18E7: Serial.println("2"); break;
case 0xFF7A85: Serial.println("3"); break;
case 0xFF10EF: Serial.println("4"); break;
case 0xFF38C7: Serial.println("5"); break;
case 0xFF5AA5: Serial.println("6"); break;
case 0xFF42BD: Serial.println("7"); break;
case 0xFF4AB5: Serial.println("8"); break;
case 0xFF52AD: Serial.println("9"); break;
case 0xFFFFFFFF: Serial.println(" REPEAT");break;

default:
Serial.println(" other button ");

}

delay(500);

}
void setup() {
Serial.begin(9600);
Serial.println("IR Receiver Button Decode");
irrecv.enableIRIn(); // Start the receiver
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("HOME:");
lcd.setCursor(0, 1);
lcd.print("AWAY:");

}

void loop() {
HomeScoreflag = 0;
awayScoreflag = 0;
if (irrecv.decode(&results)) // have we received an IR signal?
{
translateIR();
if (awayScoreflag = 1)
{
{
awayScore += 1;
lcd.setCursor(5,1);
lcd.print(awayScore);
irrecv.resume();
}
}
if (HomeScoreflag = 1);
{
{
homeScore += 1;
lcd.setCursor(5,0);
lcd.print(homeScore);
// irrecv.resume();
}
}
}
}

    if (awayScoreflag = 1)

Whoops !

Can you clarify what you mean by the "Whoops!"?

Matthew_Fletcher617:
Can you clarify what you mean by the "Whoops!"?

Oops . Means you did something wrong/silly

Matthew_Fletcher617:
Can you clarify what you mean by the "Whoops!"?

How do you compare two values in C ?