This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:iot-open:remotelab:sut:generalpurpose2:u2 [2019/08/04 12:07] – pczekalski | en:iot-open:remotelab:sut:generalpurpose2:u2 [2020/07/20 09:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| === Prerequisites === | === Prerequisites === | ||
| - | You need to know how to handle 4×20 characters LCD screen. In case of doubt re-work on scenarios B1 and B2.\\ <fc # | + | You need to know how to handle 4×20 characters LCD screen. In case of doubt re-work on scenarios B1 and B2.\\ <fc # |
| - | <note warning> | + | <note warning> |
| To fully experience this scenario, you need to book another node (one of 1,2,3 or 4), to let the other node act as your networking client. You can use scenario U1 for this purpose but mind to update network SSID and passphrase in your code, to let it connect to your server. <note tip> | To fully experience this scenario, you need to book another node (one of 1,2,3 or 4), to let the other node act as your networking client. You can use scenario U1 for this purpose but mind to update network SSID and passphrase in your code, to let it connect to your server. <note tip> | ||
| === Scenario === | === Scenario === | ||
| - | In this scenario, you will set up an access point and present on the LCD screen number of clients connected | + | In this scenario, you will set up an access point and present on the LCD screen number of clients connected. The devices that connect to your AP obtain automatically an IP address from your AP so actually it hosts a DHCP server out of the box! The IP range is from the '' |
| === Result === | === Result === | ||
| Line 16: | Line 16: | ||
| === Start === | === Start === | ||
| - | Define some identifiers to separate and update AP's SSID and passphrase easily. To format lines for the LCD, we suggest using a char buffer of 20 characters (one full line) and some 2-3 integers for iterators. Remember to declare the LCD control class in your code. You do not need to instantiate WiFi communication class - as you have only one interface here, it is singleton class you can refer directly using '' | + | Define some identifiers to separate and update AP's SSID and passphrase easily. To format lines for the LCD, we suggest using a char buffer of 20 characters (one full line) and some 2-3 integers for iterators. Remember to declare the LCD control class in your code. You do not need to instantiate WiFi communication class - as you have only one interface here, it is singleton class you can refer directly using '' |
| === Steps === | === Steps === | ||
| Following steps do not present full code - you need to supply missing parts on your own! | Following steps do not present full code - you need to supply missing parts on your own! | ||
| == Step 1 == | == Step 1 == | ||
| - | //Describe activities done in Step 1.// | + | Include all necessary libraries. The minimum set here is: |
| + | <code c> | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | ... | ||
| + | </code> | ||
| + | == Step 2 == | ||
| + | Give it some definitions as identifiers for cleaner code, remember to change ssid name to yours! | ||
| + | <code c> | ||
| + | #define wifi_ssid_ap put_your_unique_id_here | ||
| + | #define wifi_password_ap " | ||
| + | </ | ||
| + | <note warning> | ||
| + | == Step 3 == | ||
| + | Print some information about starting software WiFi AP, configure network interface as a WiFi AP and give it a try to start: | ||
| + | <code c> | ||
| ... | ... | ||
| + | delay(10); | ||
| + | ... | ||
| + | WiFi.mode(WIFI_AP); | ||
| + | delay(100); | ||
| + | boolean result = WiFi.softAP(wifi_ssid_ap, | ||
| + | | ||
| + | if(result == true) | ||
| + | { | ||
| + | ... //Announce success, print status, SSID and passphrase to the LCD | ||
| + | } | ||
| + | else | ||
| + | { | ||
| + | ... //Announce failure. Print it on LCD | ||
| + | } | ||
| + | ... | ||
| + | </ | ||
| - | == Step n == | + | == Step 4 == |
| - | //Describe activities done in Step n.// | + | Implement |
| + | <code c> | ||
| + | ... | ||
| + | void loop() | ||
| + | { | ||
| + | lcd.setCursor(0, | ||
| + | sprintf(buffer, | ||
| + | lcd.print(buffer); | ||
| + | delay(3000); | ||
| + | } | ||
| + | ... | ||
| + | </code> | ||
| === Result validation === | === Result validation === | ||
| - | //Provide some result validation methods, for self assesment.// | + | Check your AP is active on LCD eventually observe failure. If works OK, compile U1 scenario on another node(s), mind to update SSID and passphrase in the U1 source code then observe if connected clients counter increases. |
| === FAQ === | === FAQ === | ||
| - | This section is to be extended as new questions appear. \\ | + | Do I need to use WiFi.mode(WIFI_AP);?: |
| - | When using the printed version of this manual | + | |
| - | //Provide some FAQs in the following form:\\ | + | |
| - | **Question? | + | |
| - | // | + | |