Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:iot:examples:quickstart [2023/03/01 21:54] raivo.sellen:iot:examples:quickstart [Unknown date] (current) – external edit (Unknown date) 127.0.0.1
Line 44: Line 44:
 {{:en:iot:examples:setup:enabled.png?600|}} {{:en:iot:examples:setup:enabled.png?600|}}
  
-After that, the PlatformIO icon should show up on the left sidebar as well as an **Home** icon that redirects you to PlatformIO home.+After that, the PlatformIO icon should appear on the left sidebar and a **Home** icon redirects you to PlatformIO home. If not, restart Visual Studio Code.
  
 {{:en:iot:examples:setup:home.png?600|}} {{:en:iot:examples:setup:home.png?600|}}
Line 56: Line 56:
 {{:en:iot:examples:setup:new-project.png?600|}} {{:en:iot:examples:setup:new-project.png?600|}}
  
-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 Framework**
  
 {{:en:iot:examples:quickstart:doc1.png?600|}} {{:en:iot:examples:quickstart:doc1.png?600|}}
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 parameters:+Add the following line to include the ITTIoT Library and other parameters (check correct port instead of example COM3):
  
 <code> <code>
 upload_speed = 921600 upload_speed = 921600
 upload_port = COM3 upload_port = COM3
 +//upload_port = COM3 // In case of Linux /dev/ttyUSB0
 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
  
-<code>+<code c>
 #include <Arduino.h> #include <Arduino.h>
 #include <ittiot.h> #include <ittiot.h>
Line 105: Line 106:
  
 void setup() { void setup() {
-    Serial.begin(9600); +    Serial.begin(115200); 
-    iot.setConfig("wname", ""); +    iot.setConfig("wname", "myWiFi"); //Your wifi name 
-    iot.setConfig("wpass", ""); +    iot.setConfig("wpass", "myPassword"); // Your wifi password 
-    iot.setConfig("msrv", ""); +    iot.setConfig("msrv", ""); // Your MQTT broker IP 
-    iot.setConfig("mport", ""); +    iot.setConfig("mport", ""); // Your MQTT broker port - default: 1883 
-    iot.setConfig("muser", ""); +    iot.setConfig("muser", ""); // Your MQTT broker user name - default empty 
-    iot.setConfig("mpass", "");+    iot.setConfig("mpass", ""); // Your MQTT broker password - default empty
     iot.printConfig(); // print json config to serial     iot.printConfig(); // print json config to serial
     iot.setBootPin(5);     iot.setBootPin(5);
Line 122: Line 123:
 </code> </code>
  
-Make sure to replace the connection information with yours like so: +Make sure to replace the connection information with yours.
-<code> +
-... +
-iot.setConfig("wname", "myWiFi"); +
-iot.setConfig("wpass", "myPassword"); +
-... +
-</code> +
- +
  
 =====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, you can got to the **PIO Project Tasks** menu and select build or upload from there..+To test and upload your codefirst 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 buildpress the **Upload** icon. Alternatively, you can go to the **PIO Project Tasks** menu and select build or upload from there.
  
 {{:en:iot:examples:setup:buildupload.png?600|}} {{:en:iot:examples:setup:buildupload.png?600|}}
  
-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 there a serial monitor should have automatically opened and you should see live data from the controller like so:+If the code is compiled and uploaded successfullya serial monitor should have automatically openedand you should see live data from the controller like:
  
 {{:en:iot:examples:quickstart:doc3-1.png?600|}} {{:en:iot:examples:quickstart:doc3-1.png?600|}}
  
-If the serial monitor does not open automatically click the button below:+If the serial monitor does not open automaticallyclick the button below:
  
 {{:en:iot:examples:quickstart:doc3-2.png?600|}} {{:en:iot:examples:quickstart:doc3-2.png?600|}}
  
-This means that the code was successfully uploaded and the board has connected to the MQTT server.+This means the code was successfully uploadedand the board was connected to the MQTT server.
  
 Install the [[https://chrome.google.com/webstore/detail/mqttbox/kaajoficamnjijhkeomgfljpicifbkaf|MQTTBox]] chrome app to publish and subscribe messages to the MQTT server. Install the [[https://chrome.google.com/webstore/detail/mqttbox/kaajoficamnjijhkeomgfljpicifbkaf|MQTTBox]] chrome app to publish and subscribe messages to the MQTT server.
Line 157: Line 149:
 Configure the connection with your details and publish a message to the topic that your board is listening to (//mytopic// in the example) Configure the connection with your details and publish a message to the topic that your board is listening to (//mytopic// in the example)
  
-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:
  
 {{:en:iot:examples:quickstart:doc4-1.png?600|}} {{:en:iot:examples:quickstart:doc4-1.png?600|}}
  
en/iot/examples/quickstart.1677707663.txt.gz · Last modified: 2023/03/01 10:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0