Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
en:iot-open:practical:hardware:sut:stm32:emb5_1 [2024/04/10 20:17] – [Prerequisites] ktokarzen:iot-open:practical:hardware:sut:stm32:emb5_1 [2024/04/10 20:20] (current) – [Steps] ktokarz
Line 36: Line 36:
 Declare GPIOs controlling the LCD, according to the hardware reference: Declare GPIOs controlling the LCD, according to the hardware reference:
 <code c> <code c>
-#define LCD_RS 2 +const int rs = PC5, en = PB11, d4 = PB12, d5 = PB13, d6 = PB14, d7 = PB15;
-#define LCD_ENABLE 1 +
-#define LCD_D4 39 +
-#define LCD_D5 40 +
-#define LCD_D6 41 +
-#define LCD_D7 42+
 </code> </code>
  
 === Step 3 === === Step 3 ===
-Declare a static instance of the LCD controller class and preconfigure it with appropriate control GPIOs:+Declare an instance of the LCD controller class and preconfigure it with appropriate control GPIOs:
 <code c> <code c>
-static Adafruit_LiquidCrystal lcd(LCD_RSLCD_ENABLELCD_D4LCD_D5LCD_D6LCD_D7);+LiquidCrystal lcd(rsend4d5d6d7);
 </code> </code>
  
Line 53: Line 48:
 Initialise class with display area configuration (number of columns, here 16 and rows, here 2): Initialise class with display area configuration (number of columns, here 16 and rows, here 2):
 <code c> <code c>
-lcd.begin(16,2); +lcd.begin(16, 2);
 </code> </code>
  
Line 61: Line 56:
   * ''.setCursor(x,y)'' - set cursor, writing will start there;   * ''.setCursor(x,y)'' - set cursor, writing will start there;
   * ''.print(contents)'' - prints text in the cursor location; note there are many overloaded functions, accepting various arguments, including numerical.   * ''.print(contents)'' - prints text in the cursor location; note there are many overloaded functions, accepting various arguments, including numerical.
 +
 +A simple example can be the Hello World:
 +<code c>
 +lcd.print("hello, world!");
 +</code>
  
 ==== Result validation ==== ==== Result validation ====
en/iot-open/practical/hardware/sut/stm32/emb5_1.1712780269.txt.gz · Last modified: 2024/04/10 20:17 by ktokarz
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0