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:stm32:iot_1 [2024/04/25 20:25] – [Steps] ktokarz | en:iot-open:practical:hardware:sut:stm32:iot_1 [2024/04/27 08:15] (current) – [Result validation] ktokarz | ||
---|---|---|---|
Line 46: | Line 46: | ||
</ | </ | ||
+ | Declare two variables with the strings to be compared with the responses from the WiFi module. | ||
+ | <code c> | ||
+ | String compOK; | ||
+ | String compERROR; | ||
+ | </ | ||
=== Step 2 === | === Step 2 === | ||
- | In the Setup() function initialise the serial port and display. | + | In the Setup() function initialise the serial port, display, and strings. |
<code c> | <code c> | ||
- | | + | WiFiSerial.begin(115200); |
- | lcd.begin(16, | + | lcd.begin(16, |
+ | compOK = " | ||
+ | compERROR = " | ||
</ | </ | ||
- | Use the code template from | + | We will use the code template from [[en: |
- | ==== Result validation ==== | + | <code c> |
- | Using another node should change the MAC read. Book another device and discover its MAC. | + | WiFiSerial.println(" |
+ | lcd.setCursor(0, | ||
+ | lcd.print(" | ||
+ | do { | ||
+ | | ||
+ | lcd.setCursor(0, | ||
+ | lcd.print(response); | ||
+ | } while (!(response.startsWith(compOK))); | ||
- | ===== FAQ ===== | + | delay(1000); |
- | **Can I change | + | </ |
+ | |||
+ | The next command can be the " | ||
<code c> | <code c> | ||
- | #include < | + | +CIPSTAMAC:" |
- | # | + | </code> |
- | uint8_t newMAC[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xCA, 0xFE}; // | + | We can implement the part of displaying the MAC by repeating the block of the code similar to the one presented above with two modifications. Change the " |
- | void setup() | + | <code c> |
- | { | + | if (response.startsWith(" |
- | | + | |
- | | + | |
+ | lcd.print(response); | ||
} | } | ||
</ | </ | ||
+ | ==== Result validation ==== | ||
+ | You should be able to see the MAC address of the ESP32-C3 module. | ||
+ | < | ||
+ | Using another node should change the MAC read. Book another device and discover its MAC. | ||
+ | </ | ||
+ | <note info> | ||
+ | Because LCD can't properly display some non-visible characters the presented code sometimes shows additional, non-letter characters. It is out of the scope of this scenario to filter these characters out. We leave the task of making visual improvements to your invention. | ||
+ | </ | ||
+ | ===== 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 with another device in the same network. | ||
<WRAP noprint> | <WRAP noprint> |