Connecting an ESP8266
- USB-UART Adapter (if it is not integrated into your board).
- Access to the ESP8266's GPIO0 pin to enter flashing mode.
Creating a Project
- Create a new PlatformIO project for your board as described in the PlatformIO documentation (Visual Studio Code, Atom)
platformio.iniand add the following lines to the end:
lib_deps = cloud4rpi-esp-arduino build_flags= ; Required for PubSub library -D MQTT_MAX_PACKET_SIZE=1024 -D MQTT_MAX_TRANSFER_SIZE=128 ; Enables the verbose output to Serial -D CLOUD4RPI_DEBUG=1
platformio.inifile and open the
- Copy-paste the sample code into it.
- If you know the pin number connected to an LED on your board, replace the
BUILTIN_LEDconstant with it.
Connecting to Your Cloud4RPi Account
- Log in to your Cloud4RPi account or create a new one.
- Copy your device's Device Token. You can create a device on the Devices page and copy its Device Token if you do not have one.
- Replace the
__YOUR_DEVICE_TOKEN__string with your device token.
- Replace the
__PASSWORD__strings with your Wi-Fi network data.
- Hit the
Buildbutton and wait until the compilation is completed.
- Connect the board in the flashing mode (power it with the GPIO0 pin connected to GND) and hit the
- Once flashing is complete, open
Serial Monitorand watch the sample code's output.
- Notice that the device went online and started sending data.
- Go to the Control Panels page and add a new control panel.
- Add a new Chart widget and bind it to the
- Add a new Switch widget and bind it to the
- Add a new Text widget and bind it to the
STATUSvariable. Configure different colors for the "IDLE", "RING" and "BOOM!" strings.