I hope someone is still reading this.
I am totally screwed. Even after implementing some of the timing suggestions, still didn’t work.
I thought I traced it to the temp probes but after disabling them, still didn’t work.
Went back to the drawing board and put together test button presses.
Nothing would register.
Looks like it is in the switch case section. I commented it out and put in if’s to read the buttons and it started working.
Any idea what’s wrong with the switch case method?
I also noticed that while no button is being pressed, random codes appear to be received as displayed in the fourth line of the data screen.
Another puzzler is the menu button goes back to the Splash screen but doesn’t pause like it does at reset or power up. It immediately goes on to the data screen.
#include <IRremote.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); //Set LCD I2C address
int recv_pin=11; //IR receive input pin
IRrecv irrecv(recv_pin);
decode_results results;
unsigned long lastcode;
int volup =0;
int voldn=0;
int chaup=0;
int chadn=0;
int right=0;
int left=0;
//**********************Void Setup*********************************
void setup() {
irrecv.enableIRIn(); //Start the IR receiver
lcd.begin(20, 4);
splash();
}
//****************************************************************************
// Void Loop
//****************************************************************************
void loop() {
//*********** Read button presses from remote ****************
if(irrecv.decode(&results)){
if(results.value != 0xFFFFFFFF)
{lastcode=results.value;}
/*switch (lastcode) { //Adjust HLT or MLT setpoint based on menu value (Case select)
case 0x2A71BFFD: // Menu button, back to splash screen
splash();
break;
case 0x636d99da: //Right arrow
right++;
break;
case 0xD20E2899: //Left arrow
left++;
break;
case 0x22d912bb: // Volume up button
volup++;
break;
case 0x776c6e7a: // Volume down button
voldn--;
break;
}
irrecv.resume();
}
*/
if(lastcode==0x22d912bb){ //5846514513 0x22d912bb
volup++;
}
if(lastcode==0x776c6e7a){
voldn++;
}
if(lastcode==0x636d99da){
right++;
}
if(lastcode==0xD20E2899){
left++;
}
if(lastcode==0x2A71BFFD){
splash();
}
irrecv.resume();
}
PrintData();
}
//******************Below are Functions called from above******************************************
void PrintData(){
// First Row
lcd.setCursor(6, 0);
lcd.print(volup);
lcd.setCursor(17, 0);
lcd.print(voldn);
// Second Row
lcd.setCursor(6, 1);
lcd.print(chaup);
lcd.setCursor(17, 1);
lcd.print(chadn);
// Third Row
lcd.setCursor(6, 2);
lcd.print(right);
lcd.setCursor(17, 2);
lcd.print(left);
// Fourth Row
lcd.setCursor(0,3);
lcd.print(lastcode);
}
void Static(){
lcd.clear();
lcd.home();
// First Row
lcd.setCursor(0, 0);
lcd.print("Vol +");
lcd.setCursor(10, 0);
lcd.print("Vol -");
// Second Row
lcd.setCursor(0, 1);
lcd.print("Cha +");
lcd.setCursor(10, 1);
lcd.print("Cha -");
// Third Row
lcd.setCursor(0, 2);
lcd.print("Right");
lcd.setCursor(10, 2);
lcd.print("Left");
}
void splash(){
lcd.clear();
lcd.home();
lcd.setCursor(4, 0);
lcd.print("WELCOME TO");
lcd.setCursor(18, 0);
lcd.write(3); //Upper left logo
lcd.write(4); //Upper right logo
lcd.setCursor(3, 1);
lcd.print("Hickey Brewing");
lcd.setCursor(18, 1);
lcd.write(5); //Lower left logo
lcd.write(6); //Lower right logo
lcd.setCursor(3, 2);
lcd.print("press any key");
lcd.setCursor(0, 3);
lcd.print("v2.2 to start");
//This will pause program until a button is pressed, then continue with void loop.
while (irrecv.decode(&results)==LOW) {
delay(10);
}
irrecv.resume();
Static();
}