Output Device
This week I am going to play with a output device.
For my final project, I am measuring the output voltage of strain gauge.
I want to print out the reading from ADC to a LCD screen.
-------------
Wiring
I followed this tutorial to set up the board.
-------------
Code
The code uses LiquidCrystal library. I need to define the pins for the connection.
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* LCD VSS pin to ground
* LCD VCC pin to 5V
I use the code from tutorial. Hello World
I revise the code, so it prints out a voltage.
-------------
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("Reading Voltage");
}
void loop()
{
float V = 0.12345678;
lcd.setCursor(0, 1);
lcd.print("V=");
lcd.print(V,5);
lcd.print("V");
// Print 5 digits
}
-------------
-------------
-------------