Please provide a code for the following project. thanks. -----------------------
ID: 2291673 • Letter: P
Question
Please provide a code for the following project. thanks.
-----------------------------------------------------------------------------------------------
This project utilizes the LCD display to display the A/D count and voltage of a potentiometer connected to the arduino. a. Connect LCD display as shown in class b. Connect potentiometer to Arduino. C. Modifiy software to display the A/D count and voltage read on potentiometer. See picture below d. As the potentiometer is rotated from one end stop to the other the A/D count will go from 0-1023 and the voltage will go from 0-5 volts. H D 432 Voltage 2.11Explanation / Answer
/*
The circuit:
* 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
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
* Potentiometer to analog pin 0
*/
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup()
{
lcd.begin(16, 2);
}
void loop()
{
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1023.0);
lcd.print("A/D Voltage ")
lcd.print(sensorValue voltage);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.