Hello everyone!
I am trying to make the arduino to measure voltage in a circuit. Everything works as should, however, after a while my display corrupts and I get bunch of weird symbols on it. I was wondering what is wrong here. Thank you!
PS: I am a new user, was playing with arduino only for a few days
Here is the code of a program:
#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)
float R2 = 10000.0; // resistance of R2 (10K)
int value = 0;
void setup(){
pinMode(analogInput, INPUT);
lcd.begin(16, 2);
lcd.print("DC VOLTMETER");
}
void loop(){
// read the value at analog input
value = analogRead(analogInput);
vout = (value * 5.0) / 1024.0;
vin = vout / (R2/(R1+R2));
if (vin<0.09) {
vin=0.0;//statement to quash undesired reading !
}
lcd.setCursor(0, 1);
lcd.print("INPUT V= ");
lcd.print(vin);
delay(500);
}
You need to use the Auto-Format option in the IDE - under "Tools" or simply Control-T.
There are two possible causes of this. Either RAM overflow in the string functions - which I cannot assess as such - or some supply problem with the LCD. Try a 47 µF capacitor across pins 1 and 2 of the LCD.
Paul__B:
You need to use the Auto-Format option in the IDE - under “Tools” or simply Control-T.
There are two possible causes of this. Either RAM overflow in the string functions - which I cannot assess as such - or some supply problem with the LCD. Try a 47 µF capacitor across pins 1 and 2 of the LCD.
You said I need to try a capacitor, do I also still need to connect those pins as they were before?