This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| en:iot-open:remotelab:ume:smartme:b1 [2019/09/27 10:09] – created salvatdi | en:iot-open:remotelab:ume:smartme:b1 [2020/07/20 09:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== B1: Basic operations on the 2x20 LCD screen | + | ==== IB1: Basic operations on the 2x16 LCD screen ==== |
| Whatever you do, you expect to have some output of the system. | Whatever you do, you expect to have some output of the system. | ||
| Line 7: | Line 7: | ||
| Perhaps those are the reasons why you will use the LCD display in every lab work you will do. | Perhaps those are the reasons why you will use the LCD display in every lab work you will do. | ||
| - | ===== Target group ===== | + | === Target group ==== |
| This hands-on lab guide is intended for the Beginners but other target groups may benefit from it, treating it as basics for advanced projects. | This hands-on lab guide is intended for the Beginners but other target groups may benefit from it, treating it as basics for advanced projects. | ||
| - | ==== Prerequisites | + | === Prerequisites === |
| There are no other prerequisites besides the Liquid Crystal library. | There are no other prerequisites besides the Liquid Crystal library. | ||
| - | All the nodes of SmartME Network Laboratory are equipped with an LCD Displaytech 162B based on the HD44780 standard. | + | All the nodes of SmartME Network Laboratory are equipped with a 2x16 LCD Displaytech 162B based on the HD44780 standard. |
| - | It is necessary to initialize the library by associating any pin of the LCD interface | + | It is necessary to initialize the library by associating any pin of the LCD interface to the Arduino pin number to which it is connected (see Step 2). |
| - | The circuit: | + | == The circuit: |
| - | LCD pin 1 = 5v+ (220 ohm resistance) | + | |
| - | LCD pin 2 = GND | + | |
| - | LCD pin 3 = GND | + | |
| - | LCD pin 4 = 5v | + | |
| - | LCD pin 5 = center of potentiometer (potentiometer leg 1 goes to 5v and leg 3 goes to ground) | + | |
| - | LCD pin 6 = Arduino pin 7 | + | |
| - | LCD pin 7 = GND | + | |
| - | LCD pin 8 = Arduino pin 6 | + | |
| - | LCD pin 13 = Arduino pin 5 | + | |
| - | LCD pin 14 = Arduino pin 4 | + | |
| - | LCD pin 15 = Arduino pin 13 | + | |
| - | LCD pin 16 = Arduino pin 2 | + | |
| - | Scenario | + | === Scenario |
| - | Initialize the LCD screen with the text “SmartMe | + | |
| - | Result | + | Initialize the LCD screen with the text “SmartMe |
| + | Delays | ||
| + | |||
| + | === Result | ||
| You should see the text "Smart lab!" appearing and disappearing every half second. | You should see the text "Smart lab!" appearing and disappearing every half second. | ||
| - | Start | + | |
| + | === Start === | ||
| There are no special steps to be performed. | There are no special steps to be performed. | ||
| - | Steps | + | === Steps === |
| - | Step 1 | + | |
| + | == Step 1 == | ||
| Include LCD driver library: | Include LCD driver library: | ||
| + | |||
| + | <code c> | ||
| #include < | #include < | ||
| - | Step 2 | + | </ |
| + | |||
| + | == Step 2 == | ||
| Instantiate the software controller component for the LCD display: | Instantiate the software controller component for the LCD display: | ||
| + | <code c> | ||
| // initialize the library with the numbers of the interface pins | // initialize the library with the numbers of the interface pins | ||
| LiquidCrystal lcd(7, 6, 5, 4, 13, 2); | LiquidCrystal lcd(7, 6, 5, 4, 13, 2); | ||
| - | + | </ | |
| - | Step 3 | + | |
| + | == Step 3 == | ||
| Initialize display - we suggest to do it in the setup() function: | Initialize display - we suggest to do it in the setup() function: | ||
| + | <code c> | ||
| void setup() { | void setup() { | ||
| // set up the LCD's number of columns and rows | // set up the LCD's number of columns and rows | ||
| Line 59: | Line 71: | ||
| lcd.print(" | lcd.print(" | ||
| } | } | ||
| + | </ | ||
| - | Step 4 | + | == Step 4 == |
| Implement loop() to turn off and on the LCD display, for 500 ms each: | Implement loop() to turn off and on the LCD display, for 500 ms each: | ||
| + | <code c> | ||
| void loop() { | void loop() { | ||
| // turn off the display | // turn off the display | ||
| Line 71: | Line 86: | ||
| delay(500); | delay(500); | ||
| } | } | ||
| + | </ | ||
| - | Result validation | + | === Result validation |
| Observe the text appearing and disappearing every half second. | Observe the text appearing and disappearing every half second. | ||
| - | Platformio.ini | + | === Platformio.ini |
| - | + | < | |
| [env:uno] | [env:uno] | ||
| platform = atmelavr | platform = atmelavr | ||
| Line 88: | Line 103: | ||
| lib_deps_external = | lib_deps_external = | ||
| | | ||
| + | </ | ||
| - | B1.cpp | + | === IB1.cpp === |
| + | <code c> | ||
| #include < | #include < | ||
| // initialize the library with the numbers of the interface pins | // initialize the library with the numbers of the interface pins | ||
| Line 111: | Line 127: | ||
| delay(500); | delay(500); | ||
| } | } | ||
| + | </ | ||