Een lcd-display aansturen met een Arduino
FunduinoGepubliceerd op
Verkabelung, Kontrast und der erste Text auf dem Display
Dat heb je nodig
Für schnelle Basteleien sind ein LCD-Keypad-Shield oder ein I2C-LCD bequemer – dafür etwas teurer.
1602 I2C LCD-module - 2x16 tekens, HD44780, blauw
3,02 € *Art.-Nr. FUN-1010568Naar het product — 1602 I2C LCD-module - 2x16 tekens, HD44780, blauw
LCD Keypad Shield 1602 - 16x2-display, 5 knoppen, voor Arduino UNO
4,10 € *Art.-Nr. F23107306Naar het product — LCD Keypad Shield 1602 - 16x2-display, 5 knoppen, voor Arduino UNO
Funduino UNO R3-microcontroller - ATmega328P, 16 MHz, voor Arduino
11,12 € *Art.-Nr. F23107480Naar het product — Funduino UNO R3-microcontroller - ATmega328P, 16 MHz, voor Arduino
Breadboard met 830 contacten - steekbord voor Arduino, soldeervrij
2,90 € *Art.-Nr. FUN-1010553Naar het product — Breadboard met 830 contacten - steekbord voor Arduino, soldeervrij
Breadboardkabels male-male - 40 stuks, 20 cm
1,74 € *Art.-Nr. FUN-1010558Naar het product — Breadboardkabels male-male - 40 stuks, 20 cm
Alle 5 onderdelen samen 22,88 € *
* Alle prijzen incl. wettelijke btw, excl. verzendkosten.
Het schakelschema
De programmacode
Tekst weergeven op het lcd-scherm
#include <LiquidCrystal.h> //Load the LCD library
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //This line specifies which pins on the microcontroller board are used for the LCD (it's best not to change them for now).
void setup()
{
lcd.begin(16, 2); //In the setup, specify how many characters and lines are used. Here: 16 characters in 2 lines.
}
void loop()
{
lcd.setCursor(0, 0); //Set the starting position for the display on the LCD. lcd.setCursor(0,0) means: first character in the first line.
lcd.print("www.funduino.de"); //The text “www.funduino.de” should appear there. The microcontroller board knows the lcd.setCursor command because the library was called.
lcd.setCursor(0, 1); // lcd.setCursor(0,1) means: first character in the second line.
lcd.print("Viel Erfolg"); //The text “Good luck!!!” should then appear there.
}Variant: afwisselend boven en onder
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
lcd.begin(16, 2);
}
void loop()
{
lcd.setCursor(0, 0);
lcd.print("Oben"); //Beginn beim ersten Zeichen in der ersten Zeile mit dem Text „Oben“.
delay (2000); //Zwei Sekunden warten.
lcd.clear(); //Display löschen.
lcd.setCursor(5, 1);
lcd.print("unten"); //Erneuter Beginn beim fünften Zeichen in der zweiten Zeile mit dem Text „Unten“.
delay (2000); //Zwei Sekunden warten.
lcd.clear(); //Display löschen.
}Handleiding beoordelen