This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:iot:examples:quickstart [2023/03/01 21:54] – raivo.sell | en:iot:examples:quickstart [Unknown date] (current) – external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 44: | Line 44: | ||
{{: | {{: | ||
- | After that, the PlatformIO icon should | + | After that, the PlatformIO icon should |
{{: | {{: | ||
Line 56: | Line 56: | ||
{{: | {{: | ||
- | Give your project a name, select the board **WeMos D1 MINI ESP32 (WEMOS)** and the framework as **Arduino** | + | Give your project a name, select the board **WeMos D1 MINI ESP32 (WEMOS)** and the framework as **Arduino |
{{: | {{: | ||
Line 68: | Line 68: | ||
The **platformio.ini** file is the PlatformIO Configuration File for your project. It shows the platform, board, and framework for your project. You can also add other configurations like libraries to be included, upload options, changing the Serial Monitor baud rate and other configurations. | The **platformio.ini** file is the PlatformIO Configuration File for your project. It shows the platform, board, and framework for your project. You can also add other configurations like libraries to be included, upload options, changing the Serial Monitor baud rate and other configurations. | ||
- | Add the following line to include the ITTIoT Library and another | + | Add the following line to include the ITTIoT Library and other parameters |
< | < | ||
upload_speed = 921600 | upload_speed = 921600 | ||
upload_port = COM3 | upload_port = COM3 | ||
+ | // | ||
monitor_speed = 115200 | monitor_speed = 115200 | ||
lib_deps = ITTIoT | lib_deps = ITTIoT | ||
Line 87: | Line 88: | ||
Paste the following example code to main.cpp | Paste the following example code to main.cpp | ||
- | < | + | < |
#include < | #include < | ||
#include < | #include < | ||
Line 105: | Line 106: | ||
void setup() { | void setup() { | ||
- | Serial.begin(9600); | + | Serial.begin(115200); |
- | iot.setConfig(" | + | iot.setConfig(" |
- | iot.setConfig(" | + | iot.setConfig(" |
- | iot.setConfig(" | + | iot.setConfig(" |
- | iot.setConfig(" | + | iot.setConfig(" |
- | iot.setConfig(" | + | iot.setConfig(" |
- | iot.setConfig(" | + | iot.setConfig(" |
iot.printConfig(); | iot.printConfig(); | ||
iot.setBootPin(5); | iot.setBootPin(5); | ||
Line 122: | Line 123: | ||
</ | </ | ||
- | Make sure to replace the connection information with yours like so: | + | Make sure to replace the connection information with yours. |
- | < | + | |
- | ... | + | |
- | iot.setConfig(" | + | |
- | iot.setConfig(" | + | |
- | ... | + | |
- | </ | + | |
- | + | ||
=====Uploading code using PlatformIO IDE===== | =====Uploading code using PlatformIO IDE===== | ||
- | To test and upload your code first save your code and then click on the **Build** icon on the bottom of the editor to verify that your code can be ran. After a successful build press the **Upload** icon. Alternatively, | + | To test and upload your code, first save your code and then click on the **Build** icon at the bottom of the editor to verify that your code can be run. After a successful build, press the **Upload** icon. Alternatively, |
{{: | {{: | ||
- | Continue to the next page to verify that everything is working as expected | ||
====== Verifying the connection ====== | ====== Verifying the connection ====== | ||
- | If the code compiled and uploaded successfully | + | If the code is compiled and uploaded successfully, a serial monitor should have automatically opened, and you should see live data from the controller like: |
{{: | {{: | ||
- | If the serial monitor does not open automatically click the button below: | + | If the serial monitor does not open automatically, click the button below: |
{{: | {{: | ||
- | This means that the code was successfully uploaded and the board has connected to the MQTT server. | + | This means the code was successfully uploaded, and the board was connected to the MQTT server. |
Install the [[https:// | Install the [[https:// | ||
Line 157: | Line 149: | ||
Configure the connection with your details and publish a message to the topic that your board is listening to (// | Configure the connection with your details and publish a message to the topic that your board is listening to (// | ||
- | The board should receive the message and print it out in the serial monitor: | + | The board should receive the message and print it out on the serial monitor: |
{{: | {{: | ||