This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| en:iot-open:practical:hardware:sut:stm32:emb5_1 [2024/04/10 23:17] – [Prerequisites] ktokarz | en:iot-open:practical:hardware:sut:stm32:emb5_1 [2024/04/10 23:20] (current) – [Steps] ktokarz | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== STM_5: Using LCD Display ===== | ||
| + | Alphanumerical LCD is one of the most popular output devices in the Embedded and IoT. Using LCD with predefined line organisation (here, 2 lines, 16 characters each) is as simple as sending a character' | ||
| + | |||
| + | In this scenario, you will learn how to handle easily LCD to present information and retrieve it visually with a webcam. | ||
| + | |||
| + | ===== Prerequisites ===== | ||
| + | Familiarise yourself with a hardware reference. LCD of this type can be connected to the microcontroller with 8 or 4 lines of data, RS - register select, R/#W - read/write, and EN - synchronisation line. In our lab equipment, the LCD is controlled with 6 GPIOs. We use 4 lines for data and because We don't read anything from the LCD the R/#W is connected to the ground. Details can be found in //Table 1: STM32WB55 Node Hardware Details// on the STM32 laboratory hardware reference page. | ||
| + | You are going to use a library to handle the LCD. It means you need to add it to your '' | ||
| + | <code bash> | ||
| + | lib_deps = arduino-libraries/ | ||
| + | </ | ||
| + | |||
| + | ===== Suggested Readings and Knowledge Resources ===== | ||
| + | * [[en: | ||
| + | * [[en: | ||
| + | * [[en: | ||
| + | * [[en: | ||
| + | ===== Hands-on Lab Scenario ===== | ||
| + | |||
| + | ==== Task to be implemented ==== | ||
| + | Draw "Hello World" in the upper line of the LCD and "Hello IoT" in the lower one. | ||
| + | |||
| + | ==== Start ==== | ||
| + | Check if you can see a full LCD in your video stream. Book a device and create a dummy Arduino file with '' | ||
| + | |||
| + | |||
| + | ==== Steps ==== | ||
| + | |||
| + | === Step 1 === | ||
| + | Include the library in your source code: | ||
| + | <code c> | ||
| + | #include < | ||
| + | </ | ||
| + | |||
| + | === Step 2 === | ||
| + | Declare GPIOs controlling the LCD, according to the hardware reference: | ||
| + | <code c> | ||
| + | const int rs = PC5, en = PB11, d4 = PB12, d5 = PB13, d6 = PB14, d7 = PB15; | ||
| + | </ | ||
| + | |||
| + | === Step 3 === | ||
| + | Declare an instance of the LCD controller class and preconfigure it with appropriate control GPIOs: | ||
| + | <code c> | ||
| + | LiquidCrystal lcd(rs, en, d4, d5, d6, d7); | ||
| + | </ | ||
| + | |||
| + | === Step 4 === | ||
| + | Initialise class with display area configuration (number of columns, here 16 and rows, here 2): | ||
| + | <code c> | ||
| + | lcd.begin(16, | ||
| + | </ | ||
| + | |||
| + | === Step 5 === | ||
| + | Implement your algorithm. The most common class methods that will help you are listed below: | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | A simple example can be the Hello World: | ||
| + | <code c> | ||
| + | lcd.print(" | ||
| + | </ | ||
| + | |||
| + | ==== Result validation ==== | ||
| + | You should be able to see "Hello World" and "Hello IoT" on the LCD now. | ||
| + | |||
| + | <WRAP noprint> | ||
| + | ===== Project information ===== | ||
| + | {{: | ||
| + | This Intellectual Output was implemented under the Erasmus+ KA2.\\ | ||
| + | Project IOT-OPEN.EU Reloaded – Education-based strengthening of the European universities, | ||
| + | Project number: 2022-1-PL01-KA220-HED-000085090. | ||
| + | |||
| + | **__Erasmus+ Disclaimer__**\\ | ||
| + | This project has been funded with support from the European Commission. \\ | ||
| + | This publication reflects the views of only the author, and the Commission cannot be held responsible for any use that may be made of the information contained therein. | ||
| + | |||
| + | **__Copyright Notice__**\\ | ||
| + | This content was created by the IOT-OPEN.EU Reloaded consortium, 2022, | ||
| + | The content is Copyrighted and distributed under CC BY-NC [[https:// | ||
| + | <figure label> | ||
| + | {{: | ||
| + | </ | ||
| + | |||
| + | </ | ||