Difference between revisions of "IoT - Collabs - ESP Firmware with Guru"
Jump to navigation
Jump to search
(→MQTT) |
|||
Line 42: | Line 42: | ||
This is intended to be added to the [[#Baseline|baseline]]. | This is intended to be added to the [[#Baseline|baseline]]. | ||
− | + | ||
You'll need to add: | You'll need to add: | ||
lib_deps = | lib_deps = | ||
PubSubClient | PubSubClient | ||
to your <code>platformio.ini</code> file. | to your <code>platformio.ini</code> file. | ||
+ | |||
+ | ==== main.cpp ==== | ||
+ | |||
+ | Add: | ||
+ | |||
+ | <code>setup_mqtt();</code> | ||
+ | |||
+ | to '''setup()''' after the <code>setup_wifi();</code> call. | ||
+ | |||
+ | Put: | ||
+ | |||
+ | <code>DOtheBloodyMQTT();</code> | ||
+ | |||
+ | inside '''loop()''' | ||
[[Modular ESP Firmware - MQTT - Declarations and Defines|Declarations and Defines]] | [[Modular ESP Firmware - MQTT - Declarations and Defines|Declarations and Defines]] |
Revision as of 16:27, 2 January 2021
Contents
Modular Firmware
Baseline
This is the basis for pretty much ANY ESP-based firmware project. It'll get your device online.
main.cpp
1 #include "TopSecret.h"
2 #include "functions.h"
3
4 void setup()
5 {
6 Serial.begin(115200);
7 delay(50); // Delay to let the ESP get booted before sending out serial data
8 Serial.printf("\n+---------------------------------------+\n");
9 Serial.printf("| ESP Baseline |\n");
10 Serial.printf("+---------------------------------------+\n");
11
12 setup_wifi();
13
14 // Turn off the On-board LED (notice that it's inverted on most ESP boards)
15 pinMode(LED_BUILTIN, OUTPUT);
16 digitalWrite(LED_BUILTIN, HIGH);
17 }
18
19 void loop()
20 {
21 // put your main code here, to run repeatedly:
22 }
The parts
Work Environment (Platformio/VSC setup)
MQTT
This is intended to be added to the baseline.
You'll need to add:
lib_deps = PubSubClient
to your platformio.ini
file.
main.cpp
Add:
setup_mqtt();
to setup() after the setup_wifi();
call.
Put:
DOtheBloodyMQTT();
inside loop()
OTA
Gurus source code...
Ffffffuuuuuuuu......
Configuration HotSpot
Wiegand RFID keypad
NeoPixels
Extreme WIP
This is intended to be added to the baseline.
You'll need to add:
lib_deps = Adafruit NeoPixel
to your platformio.ini
file.
and put
#include <Adafruit_NeoPixel.h>
in your source
Web Serving
TFT Display
Climate Sensing
Energy Monitoring
Modularization Tutorial (WIP)
The source code...