|
Hi, I have the following program, which is straight forward from the tutorial, the only diference is that I have set the output to my LCD. The Problem is that I get the volts displayed as follows ex. 2.312.312.312.31 and the same below on the secon line. I am using a 16X2 LCD Here is the program:#
// include the library code: #include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins LiquidCrystal lcd(8,9,4,5,6,7);
void setup(){ // set up the LCD's number of columns and rows: lcd.begin(16, 2); // initialize the serial communications: Serial.begin(9600); }
// the loop routine runs over and over again forever: void loop() { // read the input on analog pin 7: int sensorValue = analogRead(A7); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V): float voltage = sensorValue * (5.0 / 1023.0); // print out the value you read: lcd.print(voltage); }#
Can anyone help this newbie please?
Thank you
|