Programming the ESP32 microcontroller to receive sensor data
Now, we have to configure our Heltec ESP32 device to receive the sensor data and send it to the far edge cluster by doing a request across the wireless network. To start, we must create another file by clicking File | New and replacing the default content with the following code:
#include "heltec.h" #include "WiFi.h" #include <HTTPClient.h> #define BAND 915E6 #define METRICS_IP "192.168.0.241" void setup() { Heltec.begin(false, true, true, true, BAND); Serial.begin(9600); LoRa.setSyncWord(0xF3); Serial.println("LoRa started"); WIFISetUp(); } void WIFISetUp(void) { WiFi.disconnect(true); delay(100); WiFi.mode(WIFI_STA); WiFi.setAutoConnect(true); WiFi.begin("NET_NAME","PASSWORD"); delay(100); ...