Skip to content

Commit

Permalink
build on esp8266
Browse files Browse the repository at this point in the history
  • Loading branch information
bertmelis committed Mar 28, 2023
1 parent 406a140 commit 608fdcb
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
8 changes: 8 additions & 0 deletions examples/simple-esp8266/data/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"SSID": "network-ssid",
"PSK": "network-psk",
"IPAddress": [0,0,0,0],
"hostname" : "mqtt.domain.tld",
"port": 1883,
"devicename": "testdevice"
}
22 changes: 22 additions & 0 deletions examples/simple-esp8266/simple-esp8266.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <Arduino.h>

#include <espMqttManager.h>

void setup() {
delay(10000);
Serial.begin(115200);
espMqttManager::setup();
espMqttManager::start();
}

void loop() {
static uint32_t lastMillis = 0;
if (millis() - lastMillis > 10000) {
lastMillis = millis();
uint8_t signalQuality = espMqttManagerHelpers::signalQuality();
char sqStr[5];
snprintf(sqStr, sizeof(sqStr), "%d%", signalQuality);
espMqttManager::mqttClient.publish("test/topic", 0, false, sqStr);
}
espMqttManager::loop();
}
5 changes: 4 additions & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
},
"version": "0.0.1",
"frameworks": "arduino",
"platforms": ["espressif32"],
"platforms": [
"espressif32",
"espressif8266"
],
"headers": ["espMqttManager.h"],
"dependencies": [
{
Expand Down
19 changes: 19 additions & 0 deletions scripts/CI/platformio_esp8266.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp8266]
platform = espressif8266
board = d1_mini
framework = arduino
build_flags =
;-Werror
-Wall
-Wextra
-Werror

0 comments on commit 608fdcb

Please sign in to comment.