Hi
I have some vertical lines on my display that I don’t know how to get rid of.
I’ve attached a picture of the problem.
My code looks like this:
#include <LiquidCrystal.h>
// Connections:
// rs (LCD pin 4) to Arduino pin 12
// rw (LCD pin 5) to Arduino pin 11
// enable (LCD pin 6) to Arduino pin 10
// LCD pin 15 to Arduino pin 13
// LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2
LiquidCrystal lcd(6, 5, 7, 8, 9, 10, 11);
float temp_in_celsius = 0, temp_in_kelvin=0, temp_in_fahrenheit=0;
float lux =0;
int photodiode = A1; // Selecting A1 as input pin
int sensorValue = 0; //Variable to store the value input from sensor
void setup()
{
//digitalWrite(backLight, HIGH); // turn backlight ocan. Replace 'HIGH' with 'LOW' to turn it off.
lcd.begin(20,4); // columns, rows. use 16,2 for a 16x2 LCD, etc.
lcd.clear(); // start with a blank screen
//lcd.setCursor(0,0); // set cursor to column 0, row 0 (the first row)
//lcd.print("Hello, World"); // change this text to whatever you like. keep it clean.
//lcd.setCursor(0,1); // set cursor to column 0, row 1
//lcd.print("hacktronics.com");
//lcd.setCursor(0,2); // set cursor to column 0, row 2
//lcd.print("This world rules");
//lcd.setCursor(0,3); // set cursor to column 0, row 3
//lcd.print("To the max");
}
void loop()
{
//Reads the input and converts it to Kelvin degrees
temp_in_kelvin = analogRead(0) * 0.004882812 * 100;
//Converts Kelvin to Celsius minus 2.5 degrees error
temp_in_celsius = temp_in_kelvin - 2.5 - 273.15;
temp_in_fahrenheit = ((temp_in_kelvin - 2.5) * 9 / 5) - 459.67;
//Converts BPW34 input to lux
lux = 1333 * (0.004882812 * analogRead(photodiode));
//Print the temperature in Celsius to the serial port
lcd.setCursor(0,0);
lcd.print("Celsius: ");
lcd.println(temp_in_celsius);
lcd.print((char)223);
lcd.setCursor(0,1);
lcd.print("Kelvin: ");
lcd.println(temp_in_kelvin);
//Print the temperature in Fahrenheit to the serial port
lcd.setCursor(0,2);
lcd.print("Fahrenheit: ");
lcd.println(temp_in_fahrenheit);
//Serial.println();
// Turn off the cursor:
sensorValue = analogRead(photodiode); //read the value of the sensor
lcd.setCursor(0,3);
lcd.print("Lux: ");
lcd.println(lux);
// scroll 16 positions (display length + string length) to the left
// to move it back to center:
// for (int positionCounter = 0; positionCounter < 20; positionCounter++) {
// scroll one position left:
// lcd.scrollDisplayLeft();
// delay(500);
//}
delay(1000);
}