Arduino Nano + LCD + Joystick

lcdJostick



Jumper setting of 0517 matrix board :

Matrix settings


lcdJoystick.ino code :

#include <LiquidCrystal.h>

LiquidCrystal lcd(16, 17, 4,5, 6, 7); // P1
//LiquidCrystal lcd(8,9,10,11,12,13); // P2

const int buttonPin = 8;
//const int buttonPin = 16;
int analogPinX = 5,analogPinY = 4;
//int analogPinX = 0,analogPinY = 1;
int buttonState = 0;

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  lcd.print("electronics.cat");
  pinMode(buttonPin, INPUT);
}

void loop() {
  buttonState = digitalRead(buttonPin);
  // set the cursor to column 0, line 1 (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  if (buttonState == HIGH) {
    lcd.print("F ");
  }else{
    lcd.print("N ");
  }
  lcd.print("X:");lcd.print(analogRead(analogPinX)); lcd.print(" Y:");lcd.print(analogRead(analogPinY));lcd.print(" ");
}


Involved boards :

nano-eCat
I/O matrix
LCD adapter

ArduinoNano
LCD
Joystick