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, setup the board:
In the Arduino IDE menu, select "File" → "Examples" → "Examples From Custom Libraries" → "mDash" → "Shadow". NOTE: it is important to use "Shadow" sketch!
Click on the "Upload" button to compile and upload the sketch to your board
Register new device on mdash.net and get its password (token)
Open Serial Monitor ("Tools" → "Serial Monitor"). Choose port speed 115200:
At this point, your device is not configured for WiFi, and it is not configured for mDash. Let's enter WiFi and mDash credentials. In the Serial Monitor input field, enter the following and press enter:
set wifi.sta.ssid YOUR_WIFI_NETWORK_NAME
Then set WiFi password:
set wifi.sta.pass YOUR_WIFI_PASSWORD
Switch to the mDash UI in order to get device ID and password:
Switch to the Serial Monitor and enter:
set device.id MDASH_DEVICE_ID
set device.pass MDASH_DEVICE_PASSWORD
Now WiFi and mDash credentials are saved into the configuration file
mdash.cfg on a 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 must become 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"
On mDash device dashboard, click on "OTA update" link. A file selection dialog appears. Navigate to your Arduino sketch directory, and choose the recently exported .bin file Done! Just wait until the OTA is finished.