Hi all, I'm doing a simple lighting project that uses three Pots, each Pot determines a colour (R,G,B).
I then output the chosen colour to the serial monitor and it works as intended, however I cannot make this data display on my LCD screen (I'm using the base Arduino LCD uses the Hitachi HD44780 driver).
I've followed this tutorial to no avail
Liquid Crystal Serial Display Tutorial
Here is my code:
#include <LiquidCrystal.h>
const int btnReset = 13;
const int btnPreviousTheme = 8;
const int btnNextTheme = 7;
const int LEDPin = 9;
const int NumberOfLEDS = 10;
const int redPotentio = A0;
const int greenPotentio = A1;
const int bluePotentio = A2;
int redPotentioVal = 0;
int greenPotentioVal = 0;
int bluePotentioVal = 0;
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
lcd.begin(16, 2);
Serial.begin(9600);
pinMode(LEDPin, OUTPUT);
}
void loop() {
redPotentioVal = analogRead(redPotentio);
if (redPotentioVal > 255){redPotentioVal = 255;}
delay(25);
greenPotentioVal = analogRead(greenPotentio);
if (greenPotentioVal > 255){greenPotentioVal = 255;}
delay(25);
bluePotentioVal = analogRead(bluePotentio);
if (bluePotentioVal > 255){bluePotentioVal = 255;}
delay(25);
Serial.print(" R: ");
Serial.print(redPotentioVal);
Serial.print(" G: ");
Serial.print(greenPotentioVal);
Serial.print(" B: ");
Serial.println(bluePotentioVal);
lcd.setCursor(0,0); // Sets the cursor to col 0 and row 0
if (Serial.available()) {
// wait a bit for the entire message to arrive
delay(100);
// clear the screen
lcd.clear();
// read all the available characters
while (Serial.available() > 0) {
// display each character to the LCD
lcd.print(Serial.read());
}
}
}