Make sure you have Arduino IDE v.1.8.5 or later. If you have not installed Arduino with ESP32 support yet, please follow Installing the ESP32 Board in Arduino IDE
Connect your device via USB cable. In the Arduino IDE, select the following setting options:
In the Arduino IDE menu, select "File" → "Examples" → "Examples From Custom Libraries" → "mDash" → "Shadow". NOTE: Please, use "Shadow" sketch for this tutorial!
To compile and upload your sketch to your board, click the "Upload" button.
Register your new device on mdash.net and get its password (token)
Open Serial Monitor ("Tools" → "Serial Monitor"). Select port speed 115200 baud:
At this point, your device is neither configured for WiFi nor mDash yet. Let's fix it by entering the WiFi and mDash credentials. In the Serial Monitor input field, enter the following command and click "Send":
set wifi.sta.ssid YOUR_WIFI_NETWORK_NAME
Then set the WiFi password:
set wifi.sta.pass YOUR_WIFI_PASSWORD
Switch over to the mDash UI in order to get your device ID and password:
Switch back to the Serial Monitor and enter:
set device.id MDASH_DEVICE_ID
set device.pass MDASH_DEVICE_PASSWORD
Now the WiFi and mDash credentials are saved into the configuration file
mdash.cfg on the device's filesystem.
Notice that the sketch does not contain WiFi or cloud credentials. That means that a compiled sketch could be used to OTA (over-the-air) update multiple similar devices. However, if you'd like to hardcode device credentials into the firmware, change
mDashStartWithWifi(WIFI_NAME, WIFI_PASS, DEVICE_ID, DEVICE_TOKEN).
Reboot your device by entering a
reboot command in the Serial Monitor:
Your device should now appear online on the mDash device list
Now it is time to perform over-the-air firmware update! In Arduino IDE menu, select "Sketch" > "Export compiled binary" to get a .BIN file. You might need to save off your sketch into a different one before exporting the binary file otherwise, the IDE might not allow you to export.
On mDash device dashboard, click "Firmware OTA update" button and a file selection dialog will appear. Navigate to your Arduino sketch directory, and choose the recently exported .bin file Done! Just wait until the OTA is finished.