You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+58-51Lines changed: 58 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,10 @@ Cloud4RPi Client Library for [Arduino](https://www.arduino.cc/) Framework
4
4
5
5
The package provides a client library that simplifies connecting Internet-enabled Arduino devices to the Cloud4RPi service.
6
6
7
-
Currently supported hardware:
7
+
Supported hardware:
8
8
9
9
*[ESP8266](https://en.wikipedia.org/wiki/ESP8266) boards (like [NodeMCU Dev Kit](http://www.nodemcu.com/index_en.html#fr_54747661d775ef1a3600009e) and others).
10
+
*[ESP32](https://en.wikipedia.org/wiki/ESP32) boards (like [ESP32-DevKitC](https://www.espressif.com/en/products/hardware/esp32-devkitc/overview) and others).
10
11
11
12
Supported ecosystems:
12
13
@@ -21,62 +22,68 @@ The [Cloud4RPi library](http://platformio.org/lib/show/2045/cloud4rpi-esp-arduin
21
22
22
23
1. Create a new PlatformIO project for your board as described in the PlatformIO documentation ([Visual Studio Code](http://docs.platformio.org/en/latest/ide/vscode.html#id3), [Atom](http://docs.platformio.org/en/latest/ide/atom.html#setting-up-the-project))
23
24
2. Open your `platformio.ini` and add the following lines to the end:
24
-
```
25
-
lib_deps =
26
-
cloud4rpi-esp-arduino
27
-
28
-
build_flags=
29
-
; Required for PubSub library
30
-
-D MQTT_MAX_PACKET_SIZE=1024
31
-
-D MQTT_MAX_TRANSFER_SIZE=128
32
-
; Enables the verbose output to Serial
33
-
-D CLOUD4RPI_DEBUG=1
34
-
```
35
-
4. Save the `platformio.ini` file and open the `src\main.cpp` file.
36
-
5. Copy-paste the [sample code](examples/ESP8266/ESP8266.ino) into it. <!-- common part begins here -->
37
-
4. [Log in to your Cloud4RPi account](https://cloud4rpi.io/signin) or [create a new one](https://cloud4rpi.io/register).
38
-
5. Copy [your device](https://cloud4rpi.io/devices)'s **Device Token**. You can create a device on the [Devices](https://cloud4rpi.io/devices) page and copy its **Device Token** if you do not have one.
39
-
6. Replace the `__YOUR_DEVICE_TOKEN__` string with your device token.
40
-
7. Replace the `__SSID__` and `__PASSWORD__` strings with your Wi-Fi network data.
41
-
7. If you know the pin number connected to an LED on your board, replace the `BUILTIN_LED` constant with it.
42
-
6. Hit the `Build` button and wait until the compilation is done.
43
-
8. Connect the board in the flashing mode and hit the `Upload` button.
44
-
9. Once flashing is complete, open `Serial Monitor` and watch the sample code's output.
45
-
8. Notice that the [device](https://cloud4rpi.io/devices) went online and started sending data.
46
-
9. Go to the [Control Panels](https://cloud4rpi.io/control-panels/) page and add a new control panel.
47
-
10. Add a new **Chart** widget and bind it to the `Uptime` variable.
48
-
10. Add a new **Switch** widget and bind it to the `LED On` variable.
49
-
11. Add a new **Text** widget and bind it to the `STATUS` variable. Configure different colors for the **"IDLE"**, **"RING"** and **"BOOM!"** strings.
25
+
```
26
+
lib_deps =
27
+
cloud4rpi-esp-arduino
28
+
29
+
build_flags=
30
+
; Required for PubSub library
31
+
-D MQTT_MAX_PACKET_SIZE=1024
32
+
-D MQTT_MAX_TRANSFER_SIZE=128
33
+
; Enables the verbose output to Serial
34
+
-D CLOUD4RPI_DEBUG=1
35
+
```
36
+
3. Save the `platformio.ini` file and open the `src\main.cpp` file.
37
+
4. Copy-paste the sample code ([ESP8266](https://github.com/cloud4rpi/cloud4rpi-esp-arduino/blob/master/examples/ESP8266/ESP8266.ino), [ESP32](https://github.com/cloud4rpi/cloud4rpi-esp-arduino/blob/master/examples/ESP32/ESP32.ino)). <!-- common part begins here -->
38
+
5.[Log in to your Cloud4RPi account](https://cloud4rpi.io/signin) or [create a new one](https://cloud4rpi.io/register).
39
+
6. Copy [your device](https://cloud4rpi.io/devices)'s **Device Token**. You can create a device on the [Devices](https://cloud4rpi.io/devices) page and copy its **Device Token** if you do not have one.
40
+
7. Replace the `__YOUR_DEVICE_TOKEN__` string with your device token.
41
+
8. Replace the `__SSID__` and `__PASSWORD__` strings with your Wi-Fi network data.
42
+
9. If the `LED_BUILTIN` constant is not defined in your board's library, change this constant to the LED's pin number (for example, `2`).
43
+
10. Hit the `Build` button and wait until the compilation is completed.
44
+
11. Hit the `Upload` button.
45
+
11. If the upload fails, try to start the board in the flashing mode (connect the power supply with the GPIO0 pin connected to GND) and try uploading again.
46
+
12. Once flashing is complete, open `Serial Monitor` to monitor the device's status.
47
+
13. Notice that the device on the [Devices page](https://cloud4rpi.io/devices) went online and started sending data.
48
+
14. Go to the [Control Panels](https://cloud4rpi.io/control-panels/) page and add a new control panel.
49
+
15. Add a new **Number** widget and bind it to the `Uptime` variable.
50
+
16. Add a new **Switch** widget and bind it to the `LED On` variable.
51
+
17. Add a new **Text** widget and bind it to the `State` variable. Configure different colors for the **"IDLE"**, **"RING"** and **"BOOM!"** strings.
52
+
18. Add a new **Slider** widget and bind it to the `DesiredTemp` variable, set its minimum value to 10 and maximum value to 30.
53
+
19. Add a new **Gauge** widget and bind it to the `DesiredTemp` variable, set its minimum value to 10 and maximum value to 30.
50
54
51
55
52
56
## Arduino
53
57
54
-
1. Create a new Arduino sketch and select your board in the **Tools** | **Board** menu. [Add ESP8266 support](https://github.com/esp8266/Arduino) if required.
55
-
2. Install the Cloud4RPi library from the **Library Manager**: open the **Sketch** | **Include Library** | **Manage Libraries** menu, enter `cloud4rpi` into the search field and install the **cloud4rpi-esp-arduino** package.
56
-
3. Install **ArduinoJson** and **PubSubClient** libraries. You should do it manually because the **Library Manager** does not manage package dependencies.
58
+
1.Open **Arduino**and select your board in the **Tools** | **Board** menu. Add [ESP8266](https://github.com/esp8266/Arduino#installing-with-boards-manager) or [ESP32](https://github.com/espressif/arduino-esp32/blob/master/docs/arduino-ide/boards_manager.md) support if it is not added yet.
59
+
2. Install the Cloud4RPi library from the **Library Manager**. To do this, open the **Sketch** | **Include Library** | **Manage Libraries** menu, enter `cloud4rpi` into the search field and install the **cloud4rpi-esp-arduino** package.
60
+
3. Install the dependencies: **ArduinoJson** and **PubSubClient** libraries.
57
61
4. Configure the installed libraries:
58
62
1. Open the `%HOMEPATH%\Documents\Arduino\libraries\PubSubClient\src\PubSubClient.h` (`~/Documents/Arduino/libraries/PubSubClient/src/PubSubClient.h` on Mac) file with any text editor (for instance, [VS Code](https://code.visualstudio.com)).
59
-
2. Add the following define statements at the beginning:
60
-
```c
61
-
#define MQTT_MAX_PACKET_SIZE 1024
62
-
#define MQTT_MAX_TRANSFER_SIZE 128
63
-
```
64
-
3. Open the `%HOMEPATH%\Documents\Arduino\libraries\cloud4rpi-esp-arduino\src\Cloud4RPi.h` (`~/Documents/Arduino/libraries/cloud4rpi-esp-arduino/src/Cloud4RPi.h` on Mac) file and enable verbose output by adding the `#define CLOUD4RPI_DEBUG 1` line at the beginning.
65
-
5. Open the sample code using the **File** | **Examples** | **cloud4rpi-esp-arduino** | **ESP8266** menu item. Restart Arduino IDE if this item did not appear. <!-- common part begins here -->
66
-
4. [Log in to your Cloud4RPi account](https://cloud4rpi.io/signin) or [create a new one](https://cloud4rpi.io/register).
67
-
5. Copy [your device](https://cloud4rpi.io/devices)'s **Device Token**. You can create a device on the [Devices](https://cloud4rpi.io/devices) page and copy its **Device Token** if you do not have one.
68
-
6. Replace the `__YOUR_DEVICE_TOKEN__` string with your device token.
69
-
7. Replace the `__SSID__` and `__PASSWORD__` strings with your Wi-Fi network data.
70
-
7. If you know the pin number connected to an LED on your board, replace the `BUILTIN_LED` constant with it.
71
-
6. Hit the `Verify` button and wait until the compilation is done.
72
-
8. Connect the board in the flashing mode and hit the `Upload` button.
73
-
9. Once flashing is complete, open `Serial Monitor` and watch the sample code's output.
74
-
8. Notice that the [device](https://cloud4rpi.io/devices) went online and started sending data.
75
-
9. Go to the [Control Panels](https://cloud4rpi.io/control-panels/) page and add a new control panel.
76
-
10. Add a new **Chart** widget and bind it to the `Uptime` variable.
77
-
10. Add a new **Switch** widget and bind it to the `LED On` variable.
78
-
11. Add a new **Text** widget and bind it to the `STATUS` variable. Configure different colors for the **"IDLE"**, **"RING"** and **"BOOM!"** strings.
79
-
63
+
2. Add the following define directives at the beginning:
64
+
```c
65
+
#define MQTT_MAX_PACKET_SIZE 1024
66
+
#define MQTT_MAX_TRANSFER_SIZE 128
67
+
```
68
+
3.[Optional] Open the `%HOMEPATH%\Documents\Arduino\libraries\cloud4rpi-esp-arduino\src\Cloud4RPi.h` (`~/Documents/Arduino/libraries/cloud4rpi-esp-arduino/src/Cloud4RPi.h` on Mac) file and add the `#define CLOUD4RPI_DEBUG 1` line at the beginning to enable verbose output.
69
+
5. Use the **File** | **Examples** | **cloud4rpi-esp-arduino** menu item to open the sample code. Restart Arduino IDE if this item does not appear.
70
+
5. Select the **ESP32 Dev Module** board in **Tools** menu.
71
+
6.[Log in to your Cloud4RPi account](https://cloud4rpi.io/signin) or [create a new one](https://cloud4rpi.io/register).
72
+
7. Copy [your device](https://cloud4rpi.io/devices)'s **Device Token**. You can create a device on the [Devices](https://cloud4rpi.io/devices) page and copy its **Device Token** if you do not have one.
73
+
8. Replace the `__YOUR_DEVICE_TOKEN__` string with your device token.
74
+
9. Replace the `__SSID__` and `__PASSWORD__` strings with your Wi-Fi network data.
75
+
10. If the `LED_BUILTIN` constant is not defined in your board's library, change this constant to the LED's pin number (for example, `2`).
76
+
11. Hit the `Build` button and wait until the compilation is completed.
77
+
12. Hit the `Upload` button.
78
+
13. If the upload fails, try to start the board in the flashing mode (connect the power supply with the GPIO0 pin connected to GND) and try uploading again.
79
+
13. Once flashing is complete, open `Serial Monitor` to monitor the device's status.
80
+
14. Notice that the device on the [Devices page](https://cloud4rpi.io/devices) went online and started sending data.
81
+
15. Go to the [Control Panels](https://cloud4rpi.io/control-panels/) page and add a new control panel.
82
+
16. Add a new **Number** widget and bind it to the `Uptime` variable.
83
+
17. Add a new **Switch** widget and bind it to the `LED On` variable.
84
+
18. Add a new **Text** widget and bind it to the `State` variable. Configure different colors for the **"IDLE"**, **"RING"** and **"BOOM!"** strings.
85
+
19. Add a new **Slider** widget and bind it to the `DesiredTemp` variable, set its minimum value to 10 and maximum value to 30.
86
+
20. Add a new **Gauge** widget and bind it to the `DesiredTemp` variable, set its minimum value to 10 and maximum value to 30.
0 commit comments