Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
d6f35b82be | |||
3821724a06 | |||
bcad1369af | |||
![]() |
e4ad92ca99 | ||
![]() |
89dcbf27ae | ||
![]() |
a0f5ec26d2 | ||
![]() |
c95ea1ed22 |
52
README.md
52
README.md
@ -1,8 +1,9 @@
|
||||
### Steps to run it
|
||||
### __How-To use this Project__
|
||||
|
||||
https://arduino-esp8266.readthedocs.io/en/latest/ota_updates/readme.html
|
||||
|
||||
##### create "include/wifi_credentials.h"
|
||||
1. Download and install [Visual Studio Code](https://code.visualstudio.com/download)
|
||||
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"
|
||||
4. Create [wifi_credentials.h](include/wifi_credentials.h) from [templ_wifi_credentials.h](include/templ_wifi_credentials.h) in include/
|
||||
|
||||
```cpp
|
||||
#ifndef __WIFI_CREDENTIALS_H
|
||||
@ -16,24 +17,31 @@ https://arduino-esp8266.readthedocs.io/en/latest/ota_updates/readme.html
|
||||
#endif // __WIFI_CREDENTIALS_H
|
||||
```
|
||||
|
||||
##### platformio.ini
|
||||
see templ_platformio_ini
|
||||
5. Create [platformio.ini](platformio.ini) from [templ_platformio_ini](templ_platformio_ini)
|
||||
|
||||
```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
|
||||
```sh
|
||||
$ cp templ_platformio_ini platformio.ini
|
||||
```
|
||||
|
||||
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)
|
||||
|
@ -14,7 +14,7 @@
|
||||
<div class="param_block">
|
||||
<input type="button" class="control" data-action="s_oben" value="sensor_oben">
|
||||
<input type="button" class="control" data-action="s_unten" value="sensor_unten">
|
||||
<input type="button" class="control" data-action="on_off" value="on_off">
|
||||
<!-- <input type="button" class="control" data-action="on_off" value="on_off"> -->
|
||||
</div>
|
||||
|
||||
<div class="param_block">
|
||||
|
9
include/templ_wifi_credentials.h
Normal file
9
include/templ_wifi_credentials.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef __WIFI_CREDENTIALS_H
|
||||
#define __WIFI_CREDENTIALS_H
|
||||
|
||||
#ifndef STASSID
|
||||
#define STASSID "ssid"
|
||||
#define STAPSK "key"
|
||||
#endif
|
||||
|
||||
#endif // __WIFI_CREDENTIALS_H
|
@ -355,13 +355,16 @@ void Treppe::setup() {
|
||||
// see also lib/PCA9685-Arduin/PCA9685.h:204
|
||||
pwmController.init(PCA9685_PhaseBalancer_None);
|
||||
// pwmController.init(PCA9685_PhaseBalancer_Linear);
|
||||
pwmController.setPWMFrequency(100);
|
||||
pwmController.setPWMFrequency(200);
|
||||
// pwmController.setAllChannelsPWM(idle_pwm);
|
||||
|
||||
// WARNING: before getting Parameters of Flash, make sure plausible parameters
|
||||
// are written in flash!
|
||||
EEPROM.get(EEP_START_ADDR, param); // get Parameters of flash
|
||||
param_pend = param;
|
||||
#ifndef LDR_REGELUNG
|
||||
idle_pwm_ist = param.idle_pwm_max;
|
||||
#endif
|
||||
|
||||
pinMode(13, OUTPUT);
|
||||
pinMode(0, OUTPUT);
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
// #define LDR_REGELUNG // comment in to activate LDR control
|
||||
// #define LDRDEBUG // comment in to show LDR measurement
|
||||
#define LDR_HYS 100 // Hysteresis for switching off FSM [lux]
|
||||
#define LDR_HYS 5 // Hysteresis for switching off FSM [lux]
|
||||
#define LDR_AVERAGE_SAMPLES 50
|
||||
|
||||
#define SENSOR_OBEN 16
|
||||
|
@ -9,6 +9,7 @@ extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
// OTA & WEB
|
||||
#include <ESP8266mDNS.h>
|
||||
#include "httpserver.h"
|
||||
#include "ota.h"
|
||||
#include "wifi_credentials.h"
|
||||
@ -22,7 +23,7 @@ extern "C" {
|
||||
#include "treppe.h"
|
||||
os_timer_t timer1;
|
||||
uint8_t timer_flag = 0;
|
||||
Treppe stairs(16);
|
||||
Treppe stairs(12);
|
||||
|
||||
// WIFI
|
||||
const char *ssid = STASSID;
|
||||
@ -105,6 +106,10 @@ void setup() {
|
||||
httpServer.start();
|
||||
httpServer.start_apps();
|
||||
Serial.println("HTTP server started !");
|
||||
|
||||
if (MDNS.begin("treppenlicht")) {
|
||||
Serial.println("MDNS for treppenlicht started");
|
||||
}
|
||||
|
||||
os_timer_setfn(&timer1, timerCallback, &timer_flag);
|
||||
os_timer_arm(&timer1, 20, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user