Compare commits

..

2 Commits

Author SHA1 Message Date
Simon Schmidt
609fc9181d mDNS 2021-09-07 10:58:49 +02:00
Simon Schmidt
59d99f9926 16 leds 2021-09-07 10:43:48 +02:00
4 changed files with 28 additions and 44 deletions

View File

@ -1,9 +1,8 @@
### __How-To use this Project__ ### Steps to run it
1. Download and install [Visual Studio Code](https://code.visualstudio.com/download) https://arduino-esp8266.readthedocs.io/en/latest/ota_updates/readme.html
2. Install [PlatformIO IDE extension](https://platformio.org/install/ide?install=vscode) for Visual Studio Code
3. Download sources from master branch, "zip" or "git clone" ##### create "include/wifi_credentials.h"
4. Create [wifi_credentials.h](include/wifi_credentials.h) from [templ_wifi_credentials.h](include/templ_wifi_credentials.h) in include/
```cpp ```cpp
#ifndef __WIFI_CREDENTIALS_H #ifndef __WIFI_CREDENTIALS_H
@ -17,31 +16,24 @@
#endif // __WIFI_CREDENTIALS_H #endif // __WIFI_CREDENTIALS_H
``` ```
5. Create [platformio.ini](platformio.ini) from [templ_platformio_ini](templ_platformio_ini) ##### platformio.ini
see templ_platformio_ini
```sh ```ini
$ cp templ_platformio_ini platformio.ini [env:<BOARD>]
platform = espressif8266
board = <BOARD>
framework = arduino
monitor_speed = 115200
extra_scripts = pre:extra_script.py
; stuff for OTA
; https://docs.platformio.org/en/latest/platforms/espressif8266.html#over-the-air-ota-update
upload_protocol = espota
upload_port = <IPADRESS>
upload_flags =
--port=8266
--auth=admin
``` ```
6. __Uploading new firmware__
```sh
# upload program via ota
$ pio run -t upload
# upload file system via ota
$ pio run -t uploadfs
# upload program via Serial Port
# Serial Port needs to be selected in platformio.ini
$ pio run -t upload -e serial
# upload file system via Serial Port
$ pio run -t uploadfs -e serial
```
------
Additional used sources and libraries in this project and [DOKU.md](DOKU.md)
- https://arduino-esp8266.readthedocs.io/en/latest/ota_updates/readme.html
- https://github.com/NachtRaveVL/PCA9685-Arduino
- https://arduino-esp8266.readthedocs.io/en/latest/gdb.html
- check different environments inside [platformio.ini](platformio.ini)

View File

@ -1,9 +0,0 @@
#ifndef __WIFI_CREDENTIALS_H
#define __WIFI_CREDENTIALS_H
#ifndef STASSID
#define STASSID "ssid"
#define STAPSK "key"
#endif
#endif // __WIFI_CREDENTIALS_H

View File

@ -7,7 +7,7 @@
// #define LDR_REGELUNG // comment in to activate LDR control // #define LDR_REGELUNG // comment in to activate LDR control
// #define LDRDEBUG // comment in to show LDR measurement // #define LDRDEBUG // comment in to show LDR measurement
#define LDR_HYS 5 // Hysteresis for switching off FSM [lux] #define LDR_HYS 100 // Hysteresis for switching off FSM [lux]
#define LDR_AVERAGE_SAMPLES 50 #define LDR_AVERAGE_SAMPLES 50
#define SENSOR_OBEN 16 #define SENSOR_OBEN 16

View File

@ -23,7 +23,7 @@ extern "C" {
#include "treppe.h" #include "treppe.h"
os_timer_t timer1; os_timer_t timer1;
uint8_t timer_flag = 0; uint8_t timer_flag = 0;
Treppe stairs(12); Treppe stairs(16);
// WIFI // WIFI
const char *ssid = STASSID; const char *ssid = STASSID;
@ -106,9 +106,9 @@ void setup() {
httpServer.start(); httpServer.start();
httpServer.start_apps(); httpServer.start_apps();
Serial.println("HTTP server started !"); Serial.println("HTTP server started !");
if (MDNS.begin("treppenlicht")) { if (MDNS.begin("singleLED")) {
Serial.println("MDNS for treppenlicht started"); Serial.println("MDNS for singleLED started");
} }
os_timer_setfn(&timer1, timerCallback, &timer_flag); os_timer_setfn(&timer1, timerCallback, &timer_flag);
@ -118,6 +118,7 @@ void setup() {
" PW: " + String(wifi_data.PW)); " PW: " + String(wifi_data.PW));
} }
void loop() { void loop() {
if (inter != 0u) { if (inter != 0u) {
Serial.printf("interrupt\n"); Serial.printf("interrupt\n");