I’ve encountered the problem where the second line on my display won’t work.
The second line does work with other programs so it’s not the wiring.
Here is my code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int xAxis = 0;
int yAxis = 1;
int buttonPin = 8;
int valX = 0;
int valY = 0;
int val1 = 2;
int val2 = 1;
void setup() {
lcd.begin(16, 2);
pinMode(xAxis, INPUT);
pinMode(yAxis, INPUT);
}
void loop() {
valX = analogRead(xAxis);
valX = (valX / 62);
valY = analogRead(yAxis);
valY = (valY / 62);
lcd.setCursor(2, 1);
lcd.print("Yes!");
lcd.setCursor(11, 2);
lcd.print("No!");
delay(100);
//what makes the arrow move
{
if (valY > 9) {
val2 = (val2 + 9);
}
if (valY < 7) {
val2 = (val2 - 9);
}
if (val2 > 16) {
val2 = (val2 = 10);
}
if (val2 < 0) {
val2 = (val2 = 1);
}
}
lcd.setCursor(val2, 0);
lcd.print(">");
delay(100);
lcd.clear();
}
I’m kind of new to the arduino programming language, so this program is a test for myself.