I am using Arduino SMD R2 microcontroller and serial enabled LCD 16x2 - 5V(from sparkfun)- I need a program to write so that microcontroller reads Vdc voltage and display it on LCD.
Can anyone help me in getting me a program...i will be really thankful to them.
All you need to add are a few include files, some global variables, a call to analogRead() and whatever is necessary to make the value show up on the LCD.
This in NOT the homework hotline. We don't do your homework for you.
All you need to add are a few include files, some global variables, a call to analogRead() and whatever is necessary to make the value show up on the LCD.
This in NOT the homework hotline. We don't do your homework for you.
I have started my program like this..hope atleast you will help me now..
void setup ()
{
serial.begin (9600);
}
int sensorvalue = analog read (A0);
float voltage = sensor value * (5.0/1023.0);
serial println (voltage);
}
Is my program fine...or does it require any changes or corrections
Is my program fine...or does it require any changes or corrections
Did you try it? Does it produce reasonable results?
Personally, I don't think you even tried compiling it.
The form is right. Some of the names are using the wrong case. (Serial, not serial). You are missing a dereference operator between serial and println(). sensorvalue and sensor value are different names.
Once you get it to compile, and test it, then writing to the LCD is just as easy. Create an instance of the appropriate class, and use lcd.print() instead of Serial.print().
i tried to complie it using the same program with small changes lcd.print (voltage);
i got error message saying sensor value is not declared..
sketch_jul25b:8: error: expected ',' or ';' before 'value'
sketch_jul25b:10: error: expected constructor, destructor, or type conversion before '.' token
sketch_jul25b:12: error: expected declaration before '}' token
int sensorvalue = analog read (A0);
float voltage = sensor value * (5.0/1023.0);
lcd.print (voltage);
}
sensor was not declared in this scope
error message i recevied :
sketch_jul25b:8: error: expected ',' or ';' before 'value'
sketch_jul25b:10: error: expected constructor, destructor, or type conversion before '.' token
sketch_jul25b:12: error: expected declaration before '}' token