This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pre-requirement: before changing the ESP32 sample to use NVS, please follow the sample in the official repo to ensure the basic environment, toolchain and your code are all correct. | |
This file shows the changes needed to separate the device credentials from the sample binaries in 2 steps: | |
1. Add the Azure credentials to the device's NVS (non-volatile storage) | |
2. Change the sample so it can read NVS data | |
STEP 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this sample code reuses nvs_value_sample from Espressif | |
//the original can be found under ESP-IDF/examples/storage/nvs_rw_value | |
#include <stdio.h> | |
#include "freertos/FreeRTOS.h" | |
#include "freertos/task.h" | |
#include "esp_system.h" | |
#include "nvs_flash.h" | |
#include "nvs.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Bare metal LCD sample | |
//This sketch will show the light reading in the display | |
#include <LiquidCrystal.h> | |
#include <Adafruit_Sensor.h> | |
#include <DHT.h> | |
#include <DHT_U.h> | |
#include "SPI.h" | |
//#include "sensorData.h" | |
#include "RTClib.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* Deprecation note: this Gist is here only for historic purposes. | |
* It was created before the release of the Arduino Library | |
* which is now the preferred way to get Arduino-based devices to get connected to Azure | |
* Please refer to https://aka.ms/arduino for additional guidance | |
* | |
*/ | |
#include <string.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"configurations": [ | |
{ | |
"name": "Win32", | |
"defines": [ | |
"ARDUINO=10800", | |
"USBCON" | |
], | |
"includePath": [ | |
"C:\\Program Files (x86)\\Arduino\\tools\\**", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
How to get this sample to run: | |
https://github.com/ewertons/azure-sdk-for-c/wiki/How-to-setup-and-run-Azure-SDK-for-Embedded-C-IoT-Hub-client-on-Esp8266-NodeMCU | |
*/ | |
#include <ESP8266WiFi.h> | |
#include <WiFiClientSecure.h> | |
#include <time.h> | |
#include <PubSubClient.h> |