This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:iot-open:practical:hardware:sut:esp32:iot_1 [2024/03/26 18:05] – [Task to be implemented] pczekalski | en:iot-open:practical:hardware:sut:esp32:iot_1 [2024/03/26 18:21] (current) – [Result validation] pczekalski | ||
|---|---|---|---|
| Line 28: | Line 28: | ||
| === Step 1 === | === Step 1 === | ||
| - | Include the library in your source code: | + | Include the WiFi management |
| <code c> | <code c> | ||
| - | #include <Adafruit_LiquidCrystal.h> | + | #include <WiFi.h> |
| </ | </ | ||
| + | The WiFi library automatically initialises a singleton class '' | ||
| === Step 2 === | === Step 2 === | ||
| - | Declare GPIOs controlling | + | Reading |
| <code c> | <code c> | ||
| - | #define LCD_RS 2 | + | WiFi.macAddress(); |
| - | #define LCD_ENABLE 1 | + | |
| - | #define LCD_D4 39 | + | |
| - | #define LCD_D5 40 | + | |
| - | #define LCD_D6 41 | + | |
| - | #define LCD_D7 42 | + | |
| </ | </ | ||
| - | === Step 3 === | + | ==== Result validation ==== |
| - | Declare a static instance of the LCD controller class and preconfigure it with appropriate control GPIOs: | + | Using another node should change |
| + | |||
| + | ===== FAQ ===== | ||
| + | **Can I change MAC?**: Actually, yes, you can. It is not advised, however, because you may accidentally generate an overlapping address that will collide | ||
| <code c> | <code c> | ||
| - | static Adafruit_LiquidCrystal lcd(LCD_RS, LCD_ENABLE, LCD_D4, LCD_D5, LCD_D6, LCD_D7); | + | #include < |
| - | </code> | + | # |
| - | === Step 4 === | + | uint8_t newMAC[] |
| - | Initialise class with display area configuration (number of columns, here 16 and rows, here 2): | + | void setup() |
| - | <code c> | + | { |
| - | lcd.begin(16,2); | + | WiFi.mode(WIFI_STA); |
| + | esp_wifi_set_mac(WIFI_IF_STA, & | ||
| + | } | ||
| </ | </ | ||
| - | |||
| - | === Step 5 === | ||
| - | Implement your algorithm. The most common class methods that will help you are listed below: | ||
| - | * '' | ||
| - | * '' | ||
| - | * '' | ||
| - | |||
| - | ==== Result validation ==== | ||
| - | You should be able to see "Hello World" and "Hello IoT" on the LCD now. | ||
| <WRAP noprint> | <WRAP noprint> | ||