Hello,
I would like to move the cursor in the LCD, to be able to write a combination of more numbers with the IR controller.
the function "lcd.setCursor(0, 0)" allows to set the column and the row within the bracket.
I would like to have the result showing up to the LCD screen and to get a unified variable as well.
This is what I've been able to do so far, but the cursor doesn't move...:
#include <LiquidCrystal.h>
#include <IRremote.h>
int RECV_PIN = 2; //IR
IRrecv irrecv(RECV_PIN);
decode_results results;
LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
lcd.begin(16, 2);
}
void loop()
{
if (irrecv.decode(&results)) {
translateIR();
irrecv.resume();
}
delay(100);
}
void translateIR()
{
int a=1; //trying to get
int result=a+1; // a +1 adding sum after every controller press ?
switch(results.value)
{
case 0xFF6897: case 0xC101E57B:
lcd.setCursor((a++), 1);
lcd.print("0");
Serial.println("0");
a++;
break;
case 0xFF30CF: case 0x9716BE3F:
lcd.setCursor((a++), 1);
lcd.print("1");
Serial.println("1");
a++;
break;
case 0xFF18E7: case 0x3D9AE3F7:
lcd.setCursor((a++), 1);
lcd.print("2");
Serial.println("2");
result = result+a;
break;
case 0xFF7A85: case 0x6182021B:
lcd.setCursor((result), 1);
lcd.print("3");
Serial.println("3");
break;
case 0xFF10EF: case 0x8C22657B:
Serial.println(" 4 ");
break;
case 0xFF38C7: case 0x488F3CBB:
Serial.println(" 5 ");
break;
case 0xFF5AA5: case 0x449E79F:
Serial.println(" 6 ");
break;
case 0xFF42BD: case 0x32C6FDF7:
Serial.println(" 7 ");
break;
case 0xFF4AB5: case 0x1BC0157B:
Serial.println(" 8 ");
break;
case 0xFF52AD: case 0x3EC3FC1B:
Serial.println(" 9 ");
break;
default:
Serial.println("?");
}
delay(500);
}
thanks for your help