Hello,
I have a problem in which my lcd display does not blink the cursor according to potientiometer movement. I have made a menu. Code Attatched here :-
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
int potPin1 = A1;
int potPin2 = A2;
void setup()
{
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
analogWrite(3, 10);
}
void loop() {
lcdf();
int j1 = map(potPin1, 0, 1023, 1, 5);
if (j1 = 2) {
lcd.setCursor(5, 0);
lcd.blink();
}
if (j1 = 3) {
lcd.setCursor(13, 0);
lcd.blink();
}
if (j1 = 4) {
lcd.setCursor(5, 1);
lcd.blink();
}
if (j1 = 5) {
lcd.setCursor(13, 1);
lcd.blink();
}
}
void lcdf() {
lcd.setCursor(0, 0);
lcd.print("Vol+ Vol-");
lcd.setCursor(0, 1);
lcd.print("LED+ LED-");
}
pls check it and see if i have missed anything
very thanks,
Abeer
it shows the places where the blink should be but it is on all 4 places. sorry if it's a dumb mistake as i am only a child
Meaning that you do not use a single equals sign to carry out a comparison
ohhh......i forgot as i dont do much coding nowadays
it is not blinking....here is my updated code
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
int potPin1 = A1;
int potPin2 = A2;
void setup()
{
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
analogWrite(3, 10);
lcdf();
}
void loop() {
int j1 = map(potPin1, 0, 1023, 1, 5);
if (j1 == 2) {
lcd.setCursor(5, 0);
lcd.blink();
}
if (j1 == 3) {
lcd.setCursor(13, 0);
lcd.blink();
}
if (j1 == 4) {
lcd.setCursor(5, 1);
lcd.blink();
}
if (j1 == 5) {
lcd.setCursor(13, 1);
lcd.blink();
}
}
void lcdf() {
lcd.setCursor(0, 0);
lcd.print("Vol+ Vol-");
lcd.setCursor(0, 1);
lcd.print("LED+ LED-");
}
What do you think that lcd.blink() does ?
it blinks the cursor i think?
Have you read
"Display the blinking LCD cursor. If used in combination with the cursor() function, the result will depend on the particular display."
in LiquidCrystal - Arduino Reference
Exactly which display do you have ?
You have a setCursor(), but not "cursor()"
16 by 2 white text on blue
Read this very carefully
"Display the blinking LCD cursor. If used in combination with the cursor() function, the result will depend on the particular display."
Does your code use the cursor() function ?
So go study, and leave the hobby electronics for later.
Learn to prioritise.
ok....i meant that my listening test is coming up
Did you read the quoted text carefully as I suggested ?