Liquid Crystal LCD move cursor automatically "lcd.setCursor(0, 0)"
hello,
i move cursor in lcd, able write combination of more numbers ir controller.
the function "lcd.setcursor(0, 0)" allows set column , row within bracket.
i have result showing lcd screen , unified variable well.
this i've been able far, 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 get
int result=a+1; // +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 help
i move cursor in lcd, able write combination of more numbers ir controller.
the function "lcd.setcursor(0, 0)" allows set column , row within bracket.
i have result showing lcd screen , unified variable well.
this i've been able far, 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 get
int result=a+1; // +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 help
make 'a' static
Arduino Forum > Using Arduino > Programming Questions > Liquid Crystal LCD move cursor automatically "lcd.setCursor(0, 0)"
arduino
Comments
Post a Comment