Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Without meaning to be sarcastic, the answer is probably 'your program'.
If you are getting anything on the display then the 'setup' step is working correctly.
Therefore I'd look at your 'loop' code.
However without seeing it, I can only guess.
Susan
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
int analogInput = 0;
float vout = 0.0;
float vin = 0.0;
float R1 = 100000.0; // resistance of R1 (100K) -see text!
float R2 = 10000.0; // resistance of R2 (10K) - see text!
int value = 0;
int battery = 8; // pin controlling relayA
int buzzer =7;
void setup(){
pinMode(analogInput, INPUT);
pinMode(battery, OUTPUT);
pinMode(buzzer, OUTPUT);
lcd.begin(16, 2);
lcd.print("Battery Voltage");
}
void loop(){
// read the value at analog input
value = analogRead(analogInput);
vout = (value * 5.0) / 1024.0; // see text
vin = vout / (R2/(R1+R2));
if (vin<0.09){
vin=0.0;//statement to quash undesired reading !
}
if (vin<10.6) {
digitalWrite(battery, LOW);
}
else {
digitalWrite(battery, HIGH);
}
if (vin>14.4) {
digitalWrite(battery, LOW);
}
else {
digitalWrite(battery, HIGH);
}
if (vin<10.9) {
digitalWrite(buzzer, HIGH);
}
else {
digitalWrite(buzzer, LOW);}
lcd.setCursor(0, 1);
lcd.print("INPUT V= ");
lcd.print(vin);
delay(500);}
if (vin<10.6) {
digitalWrite(battery, LOW);
}
else {
digitalWrite(battery, HIGH);
}
if (vin>14.4) {
digitalWrite(battery, LOW);
}
else {
digitalWrite(battery, HIGH);
}
well im no pro for sure
I take back the statement that I made in post 6.... lcd.print of a float does seem to work OK despite no mention in the library help
I have tried your sketch above on an Arduino Uno R3 and the LCD seems to display steady characters for me. The only change I made was to change LCD connections to suite my LCD shield.
Because your sketch seems to work OK for me, then the next thing I might suspect is the mess of wiring on your breadboard. Perhaps your wiring is picking up interference or dropping too much power somewhere? Can only guess....