Untitled Flashcard Set
1. What does the function lcd.init() do?
Answer: Initializes communication with the LCD.
2. In the provided code, which library is used to control the LCD?
Answer: LiquidCrystal_I2C.h
3. What is the role of the line #include <Wire.h>?
Answer: It is required for I2C communication.
4. The LCD used in this example is described as “16x2.” What does that mean?
Answer: 16 characters per row, 2 rows.
5. What is the purpose of lcd.backlight()?
Answer: Turns on the LCD screen light.
6. What is the function of the SDA pin in I2C communication?
Answer: Sends and receives data.
7. Which Arduino pins are used for I2C on an Uno?
Answer: SDA → A4, SCL → A5.
8. What is the function of lcd.setCursor(0,0)?
Answer: Moves the cursor to the first row, first column.
9. What does the line pinMode(7, INPUT_PULLUP); mean?
Answer: Pin 7 is input with an internal pull-up resistor.
10. When using INPUT_PULLUP, what is the button state when pressed?
Answer: LOW.
11. What value range does analogRead(A0) return for the potentiometer?
Answer: 0–1023.
12. In the line lcd.print(potValue);, what happens?
Answer: Prints the current potentiometer value.
13. Why does the code use lcd.print(" "); before printing the potentiometer value?
Answer: To overwrite old characters with spaces.
14. What happens if the LCD’s I2C address is wrong (e.g., 0x20 vs 0x27)?
Answer: The LCD will not respond.
15. What is the delay of delay(200) used for in the loop?
Answer: To stabilize readings and reduce flickering.
16. The cursor coordinates (c, r) in lcd.setCursor(c, r) start from:
Answer: (0,0).
17. Which function clears the LCD completely?
Answer: lcd.clear().
18. What is the advantage of I2C over parallel LCD wiring?
Answer: Uses fewer Arduino pins.
19. If you want to display the text "Arduino Rocks!" on the second row, first column, what command should you use?
Answer: lcd.setCursor(1,2); lcd.print("Arduino Rocks!");
20. In the example code, what does the LCD show when the button is pressed?
Answer: "1"