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:u3 [2019/10/29 20:24] – pczekalski | en:iot-open:remotelab:sut:generalpurpose2:u3 [2021/02/27 10:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 21: | Line 21: | ||
| === 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 WiFi. Note - in this scenario, you connect only once. If your connection breaks, you will have no information about it here. To handle such situation, there are multiple solutions: you can check in the loop() if the connection is OK and in case it is down, you can call your re-connecting function, or you can use one of the asynchronous handlers, triggered automatically via the WiFi manager. To use the latter approach, refer to the ESP8266 WiFi implementation for Arduino documentation. | + | 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 |
| === Steps === | === Steps === | ||
| - | Following steps do not present full code - you need to supply missing parts on your own! We do not present here how to connect to the WiFi AP. If you're in doubt, rever to the U1 scenario. We also do not present in details | + | Following steps do not present full code - you need to supply missing parts on your own! We do not present here how to connect to the WiFi AP. If you're in doubt, rever to the U1 scenario. We also do not present in details how to organise and print DHT11 sensor data on the LCD screen. Please refer to scenario B2 if you need a recall. |
| == Step 1 == | == Step 1 == | ||
| Include all necessary libraries. We use '' | Include all necessary libraries. We use '' | ||
| Line 116: | Line 116: | ||
| if (!(isnan(temp)||isnan(hum))) | if (!(isnan(temp)||isnan(hum))) | ||
| { | { | ||
| - | client.publish(tempTopic, | + | client.publish(tempTopic, |
| + | // | ||
| client.publish(humTopic, | client.publish(humTopic, | ||
| } | } | ||