init
This commit is contained in:
commit
d20e570377
3
.idea/.gitignore
vendored
Normal file
3
.idea/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
8
.idea/Eventboard_2.0.iml
Normal file
8
.idea/Eventboard_2.0.iml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
12
.idea/inspectionProfiles/Project_Default.xml
Normal file
12
.idea/inspectionProfiles/Project_Default.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredIdentifiers">
|
||||
<list>
|
||||
<option value="selenium.webdriver.Keys" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
4
.idea/misc.xml
Normal file
4
.idea/misc.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
|
||||
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/Eventboard_2.0.iml" filepath="$PROJECT_DIR$/.idea/Eventboard_2.0.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
55
README.md
Normal file
55
README.md
Normal file
|
@ -0,0 +1,55 @@
|
|||
## Eventboar Version 2.0
|
||||
|
||||
Das eventboard für deine LED - Matrix
|
||||
<br>
|
||||
######Migration von JavaScript zu Python
|
||||
|
||||
### Config
|
||||
|
||||
- in der matrix.ino dein Wlan Name und Passwort eintragen
|
||||
```
|
||||
host = 'Device Ip'
|
||||
garbage = 'true' or 'false'
|
||||
```
|
||||
- die .ino auf dein Gerät lasen (eventuell noch die Librarys installieren)
|
||||
```
|
||||
const char* ssid = "your ssid";
|
||||
const char* password = "your password";
|
||||
```
|
||||
- in der config.py deine Daten angeben
|
||||
- events in der events.json eintragen
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": {
|
||||
"day": 8,
|
||||
"month": 2,
|
||||
"year": 1989
|
||||
},
|
||||
"name": "Ines {{years}}. Geburtstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
}
|
||||
```
|
||||
|
||||
- wenn du einen Müllkalender benutzt, achte auf das format und den Filenamen 'muell.json'
|
||||
<br>
|
||||
|
||||
```json
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "16",
|
||||
"month": "02",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
}
|
||||
```
|
||||
|
||||
- hier findest du ein Beispiel, wie du ihn umwandeln kannst
|
||||
https://git.weifer.org/weifer/Kalender_zu_JSON
|
||||
|
||||
<br>
|
||||
|
||||
######Author: Marcus Ferl, marcus@weifer.de
|
6
config.py
Normal file
6
config.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
host = 'Device Ip' # ur device ip, where u upload the matrix.ino
|
||||
garbage = 'true' # set true if u have a formated Json file
|
||||
|
||||
|
||||
|
||||
get_request = '/set?text=' # dont touch this line
|
47
eventboard.py
Normal file
47
eventboard.py
Normal file
|
@ -0,0 +1,47 @@
|
|||
"""
|
||||
Eventboard script in Python
|
||||
Author: Marcus Ferl
|
||||
Email: marcus@weifer.de
|
||||
"""
|
||||
|
||||
import json
|
||||
from datetime import date
|
||||
import requests
|
||||
import config
|
||||
|
||||
|
||||
# Get current Date
|
||||
def get_current_date():
|
||||
currentDate = date.today()
|
||||
day = str('{:02d}'.format(currentDate.day))
|
||||
month = str('{:02d}'.format(currentDate.month))
|
||||
year = str(currentDate.year)
|
||||
return [day, month, year]
|
||||
|
||||
|
||||
# Raw data from Json file
|
||||
def read_JSON(filename):
|
||||
f = open(filename)
|
||||
data = json.load(f)
|
||||
f.close()
|
||||
return data
|
||||
|
||||
# Returns the Garbage
|
||||
def create_Message():
|
||||
if config.garbage == 'true':
|
||||
for i in read_JSON('muell.json'):
|
||||
day = i['date']['day']
|
||||
month = i['date']['month']
|
||||
year = i['date']['year']
|
||||
|
||||
if day == get_current_date()[0] and \
|
||||
month == get_current_date()[1] and \
|
||||
year == get_current_date()[2]:
|
||||
return i['name']
|
||||
|
||||
# Send Message to the Device
|
||||
def matrixRequest():
|
||||
requests.get('http://' + config.host + config.get_request + create_Message())
|
||||
|
||||
|
||||
matrixRequest()
|
154
events.json
Normal file
154
events.json
Normal file
|
@ -0,0 +1,154 @@
|
|||
{
|
||||
"events": [
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": {
|
||||
"day": 21,
|
||||
"month": 11,
|
||||
"year": 2021
|
||||
},
|
||||
"name": "Lottas {{years}}. Geburtstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": {
|
||||
"day": 8,
|
||||
"month": 2,
|
||||
"year": 1989
|
||||
},
|
||||
"name": "Ines {{years}}. Geburtstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": {
|
||||
"day": 2,
|
||||
"month": 5,
|
||||
"year": 1961
|
||||
},
|
||||
"name": "Rudis {{years}}. Geburtstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": {
|
||||
"day": 1,
|
||||
"month": 2,
|
||||
"year": 1936
|
||||
},
|
||||
"name": "Oma Ferls {{years}}. Geburtstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": {
|
||||
"day": 24,
|
||||
"month": 5,
|
||||
"year": 1967
|
||||
},
|
||||
"name": "Haikes {{years}}. Geburtstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": {
|
||||
"day": 19,
|
||||
"month": 2,
|
||||
"year": 1966
|
||||
},
|
||||
"name": "Marios {{years}}. Geburtstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": {
|
||||
"day": 24,
|
||||
"month": 12,
|
||||
"year": 2021
|
||||
},
|
||||
"name": "{{years}}. Verlobungstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis zum {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": {
|
||||
"day": 21,
|
||||
"month": 2,
|
||||
"year": 1985
|
||||
},
|
||||
"name": "Susannes {{years}}. Geburtstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": {
|
||||
"day": 26,
|
||||
"month": 3,
|
||||
"year": 1971
|
||||
},
|
||||
"name": "Christians Geburtstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": {
|
||||
"day": 21,
|
||||
"month": 4,
|
||||
"year": 1999
|
||||
},
|
||||
"name": "Steffens {{years}}. Geburtstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": {
|
||||
"day": 17,
|
||||
"month": 1,
|
||||
"year": 1986
|
||||
},
|
||||
"name": "Marcus Geburtstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis zu {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": {
|
||||
"day": 18,
|
||||
"month": 9,
|
||||
"year": 1943
|
||||
},
|
||||
"name": "Erikas Geburtstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": {
|
||||
"day": 20,
|
||||
"month": 9,
|
||||
"year": 1967
|
||||
},
|
||||
"name": "Michaelas Geburtstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": {
|
||||
"day": 26,
|
||||
"month": 9,
|
||||
"year": 1966
|
||||
},
|
||||
"name": "Markus Geburtstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": {
|
||||
"day": 8,
|
||||
"month": 11,
|
||||
"year": 1995
|
||||
},
|
||||
"name": "Viviennes {{years}}. Geburtstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
}
|
||||
]
|
||||
}
|
202
holidays.json
Normal file
202
holidays.json
Normal file
|
@ -0,0 +1,202 @@
|
|||
{
|
||||
"holidays": [
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": { "day": 1, "month": 1, "year": 0 },
|
||||
"name": "Neujahr",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": { "day": 1, "month": 5, "year": 1946 },
|
||||
"name": "Tag der Arbeit",
|
||||
"message": "Nur noch {{hours}} Stunden bis zum {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": { "day": 3, "month": 10, "year": 1990 },
|
||||
"name": "Tag der deutschen Einheit",
|
||||
"message": "Nur noch {{hours}} Stunden bis zum {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": { "day": 31, "month": 10, "year": 1850 },
|
||||
"name": "Halloween{1}",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": { "day": 1, "month": 11, "year": 1833 },
|
||||
"name": "Allerheiligen",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": { "day": 11, "month": 11, "year": 1833 },
|
||||
"name": "Fastnacht",
|
||||
"message": "Nur noch {{hours}} Stunden bis die {{name}} beginnt!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": { "day": 24, "month": 12, "year": 0 },
|
||||
"name": "Heilig Abend",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": { "day": 25, "month": 12, "year": 0 },
|
||||
"name": "1. Weihhnachtstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis zum {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": { "day": 26, "month": 12, "year": 0 },
|
||||
"name": "2. Weihhnachtstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis zum {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "fixed",
|
||||
"date": { "day": 31, "month": 12, "year": 0 },
|
||||
"name": "Silvester",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "advent",
|
||||
"days": 0,
|
||||
"name": "1. Advent",
|
||||
"message": "Nur noch {{hours}} Stunden bis zum {{name}}!"
|
||||
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "advent",
|
||||
"days": 7,
|
||||
"name": "2. Advent",
|
||||
"message": "Nur noch {{hours}} Stunden bis zum {{name}}!"
|
||||
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "advent",
|
||||
"days": 14,
|
||||
"name": "3. Advent",
|
||||
"message": "Nur noch {{hours}} Stunden bis zum {{name}}!"
|
||||
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "advent",
|
||||
"days": 21,
|
||||
"name": "4. Advent",
|
||||
"message": "Nur noch {{hours}} Stunden bis zum {{name}}!"
|
||||
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "advent",
|
||||
"days": -14,
|
||||
"name": "Volkstrauertag",
|
||||
"message": "Nur noch {{hours}} Stunden bis zum {{name}}!"
|
||||
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "advent",
|
||||
"days": -11,
|
||||
"name": "Buß- und Bettag",
|
||||
"message": "Nur noch {{hours}} Stunden bis zum {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "advent",
|
||||
"days": -7,
|
||||
"name": "Totensonntag",
|
||||
"message": "Nur noch {{hours}} Stunden bis zum {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "easter",
|
||||
"days": -52,
|
||||
"name": "Weiberfastnacht",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "easter",
|
||||
"days": -48,
|
||||
"name": "Rosenmontag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "easter",
|
||||
"days": -47,
|
||||
"name": "Fastnachtsdienstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "easter",
|
||||
"days": -46,
|
||||
"name": "Aschermittwoch",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "easter",
|
||||
"days": -3,
|
||||
"name": "Gründonnerstag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "easter",
|
||||
"days": -2,
|
||||
"name": "Karfreitag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "easter",
|
||||
"days": 0,
|
||||
"name": "Ostersonntag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "easter",
|
||||
"days": 1,
|
||||
"name": "Ostermontag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "easter",
|
||||
"days": 39,
|
||||
"name": "Christi Himmelfahrt",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "easter",
|
||||
"days": 49,
|
||||
"name": "Pfingstsonntag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "easter",
|
||||
"days": 50,
|
||||
"name": "Pfingstmontag",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
},
|
||||
{
|
||||
"type": "dynamic",
|
||||
"base": "easter",
|
||||
"days": 60,
|
||||
"name": "Fronleichnam",
|
||||
"message": "Nur noch {{hours}} Stunden bis {{name}}!"
|
||||
}
|
||||
]
|
||||
}
|
201
matrix.ino
Normal file
201
matrix.ino
Normal file
|
@ -0,0 +1,201 @@
|
|||
// Simple text scroller project with Web server configuration
|
||||
// Author: Csongor Varga
|
||||
// Github: https://github.com/nygma2004/max7219scroller
|
||||
|
||||
// Using the MAX7219 library of:
|
||||
// MAX7219_Dot_Matrix library - sideways scrolling
|
||||
// Author: Nick Gammon
|
||||
// Date: 2 October 2015
|
||||
|
||||
/*
|
||||
Used: C:\Users\<username>\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\libraries\ESP8266WebServer // https://github.com/esp8266/ESPWebServer
|
||||
Used: C:\Users\<username>\Documents\Arduino\libraries\MAX7219_Dot_Matrix-master // https://github.com/nickgammon/MAX7219_Dot_Matrix
|
||||
Using library ESP8266WiFi at version 1.0 in folder: C:\Users\<username>\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\libraries\ESP8266WiFi
|
||||
Using library ESP8266WebServer at version 1.0 in folder: C:\Users\<username>\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\libraries\ESP8266WebServer
|
||||
Using library ESP8266mDNS at version 1.2 in folder: C:\Users\<username>\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\libraries\ESP8266mDNS
|
||||
Using library SPI at version 1.0 in folder: C:\Users\<username>\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\libraries\SPI
|
||||
Using library bitBangedSPI-master in folder: C:\Users\<username>\Documents\Arduino\libraries\bitBangedSPI-master (legacy) // https://github.com/nickgammon/bitBangedSPI
|
||||
Using library MAX7219_Dot_Matrix-master at version 1.0.1 in folder: C:\Users\<username>\Documents\Arduino\libraries\MAX7219_Dot_Matrix-master // https://github.com/nickgammon/MAX7219_Dot_Matrix
|
||||
*/
|
||||
|
||||
|
||||
//VCC Blue - Vin on the NodeMCU, 5V on Wemos D1 mini
|
||||
//GND Purple - GND
|
||||
//DIN Grey - D7
|
||||
//CS White - D4 (this can be a different pin too)
|
||||
//CLK Black - D5
|
||||
|
||||
#include <ESP8266WiFi.h> // ESP8266 Wifi library
|
||||
#include <ESP8266WebServer.h> // Web server functions
|
||||
#include <ESP8266mDNS.h> // Web server functions
|
||||
#include <SPI.h>
|
||||
#include <bitBangedSPI.h>
|
||||
#include <MAX7219_Dot_Matrix.h>
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
|
||||
const byte chips = 4; // Number of 8x8 modules linked together
|
||||
const int msglen = 500; // Maximum length of the message
|
||||
|
||||
// Set your wifi credetials here, for open wifi leave password empty
|
||||
const char* ssid = "your ssid";
|
||||
const char* password = "your password";
|
||||
|
||||
// You can comment this section out for using DHCP
|
||||
//IPAddress ip(192, 168, 1, 85); // where xx is the desired IP Address
|
||||
//IPAddress gateway(192, 168, 1, 254); // set gateway to match your network
|
||||
//IPAddress subnet(255, 255, 255, 0); // set subnet mask to match your network
|
||||
|
||||
// n chips (display modules), hardware SPI with load on GPIO2
|
||||
MAX7219_Dot_Matrix display (chips, 2); // Chips / LOAD
|
||||
WiFiClient espClient;
|
||||
MDNSResponder mdns;
|
||||
ESP8266WebServer server(80);
|
||||
|
||||
char message [msglen] = "Visit website to customize";
|
||||
unsigned long lastMoved = 0;
|
||||
unsigned long MOVE_INTERVAL = 40; // Default delay in miliseconds
|
||||
byte intensity = 4; // Default intensity 0-15
|
||||
|
||||
int messageOffset;
|
||||
String webPage = "";
|
||||
String webStat = "";
|
||||
String webFooter = "";
|
||||
String temp = "";
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
display.begin();
|
||||
display.setIntensity(intensity);
|
||||
display.sendSmooth ("", 0);
|
||||
|
||||
// WiFi.config(ip, gateway, subnet); // Comment this line for using DHCP
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.begin(ssid, password);
|
||||
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
delay(500);
|
||||
Serial.print(".");
|
||||
}
|
||||
|
||||
Serial.println("");
|
||||
Serial.print("Connected to ");
|
||||
Serial.println(ssid);
|
||||
Serial.print("IP address: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
temp = "Visit http://";
|
||||
temp += WiFi.localIP().toString();
|
||||
temp +=" to customize";
|
||||
temp.toCharArray(message, msglen);
|
||||
Serial.print("Signal [RSSI]: ");
|
||||
Serial.println(WiFi.RSSI());
|
||||
|
||||
if (mdns.begin("max7219_display", WiFi.localIP())) {
|
||||
Serial.println("MDNS responder started");
|
||||
}
|
||||
server.on("/", handleMainPage);
|
||||
server.on("/set", handleSetCommand); // Handling parameter set
|
||||
server.on("/message", getMessage); // Get current Message in Json *Marcus Ferl*
|
||||
server.begin();
|
||||
Serial.println("HTTP server started");
|
||||
messageOffset = - chips * 8;
|
||||
|
||||
|
||||
} // end of setup
|
||||
|
||||
|
||||
|
||||
void handleMainPage() {
|
||||
webPage = "<html><body><h1>MAX7219 Display and Text Scroller</h1><p>This sketch scrolls a custom message on a MAX7219 driven 8x8 pixel display units chained one after the other.</p>";
|
||||
webPage += "<p><b>Change text</b><br/>Current text: ";
|
||||
webPage += message;
|
||||
webPage += "<br/><form action=\"/set\"><input type=\"text\" name=\"text\" value=\"";
|
||||
webPage += message;
|
||||
webPage += "\"><input type=\"submit\" value=\"Update\"></form></p>";
|
||||
|
||||
webPage += "<p><b>Change scroll speed</b><br/>Current delay: ";
|
||||
webPage += MOVE_INTERVAL;
|
||||
webPage += "<br/>Change to: <a href=\"set?delay=10\">10</a> | <a href=\"set?delay=20\">20</a> | <a href=\"set?delay=30\">30</a> | <a href=\"set?delay=40\">40</a> | <a href=\"set?delay=50\">50</a> | <a href=\"set?delay=60\">60</a> | <a href=\"set?delay=70\">70</a> | <a href=\"set?delay=80\">80</a> | <a href=\"set?delay=90\">90</a> | <a href=\"set?delay=100\">100</a>";
|
||||
webPage += "</p>";
|
||||
|
||||
webPage += "<p><b>Change brightness</b><br/>Current brightness: ";
|
||||
webPage += intensity;
|
||||
webPage += "<br/>Change to: <a href=\"set?intensity=1\">1</a> | <a href=\"set?intensity=2\">2</a> | <a href=\"set?intensity=3\">3</a> | <a href=\"set?intensity=4\">4</a> | <a href=\"set?intensity=5\">5</a> | <a href=\"set?intensity=6\">6</a> | <a href=\"set?intensity=7\">7</a> | <a href=\"set?intensity=8\">8</a> | <a href=\"set?intensity=9\">9</a> | <a href=\"set?intensity=10\">10</a> | <a href=\"set?intensity=11\">11</a> | <a href=\"set?intensity=12\">12</a> | <a href=\"set?intensity=13\">13</a> | <a href=\"set?intensity=14\">14</a> | <a href=\"set?intensity=15\">15</a>";
|
||||
webPage += "</p>";
|
||||
|
||||
webStat = "<p style=\"font-size: 90%; color: #FF8000;\">RSSI: ";
|
||||
webStat += WiFi.RSSI();
|
||||
webStat += "<br/>";
|
||||
webStat += "Uptime [min]: ";
|
||||
webStat += millis() / (1000*60);
|
||||
webStat += "</p>";
|
||||
|
||||
webFooter = "<p style=\"font-size: 80%; color: #08088A;\">MAX7219 Text Scroller v1.0 | <a href=\"mailto:csongor.varga@gmail.com\">email me</a> | <a href=\"https://github.com/nygma2004/max7219scroller\">GitHub</a></p></body></html>";
|
||||
server.send(200, "text/html", webPage+webStat+webFooter);
|
||||
Serial.println("Web page request");
|
||||
}
|
||||
|
||||
void getMessage(){
|
||||
String page;
|
||||
|
||||
StaticJsonBuffer<500> jsonBuffer;
|
||||
JsonObject& jmessage = jsonBuffer.createObject();
|
||||
jmessage["message"] = message;
|
||||
jmessage.printTo(page);
|
||||
server.send(200, "text/html", page);
|
||||
}
|
||||
|
||||
void handleSetCommand() {
|
||||
String response = "";
|
||||
if (server.args() == 0) {
|
||||
response = "No parameter";
|
||||
} else {
|
||||
if (server.argName(0) == "delay") {
|
||||
MOVE_INTERVAL = server.arg("delay").toInt();
|
||||
response = "Delay updated to ";
|
||||
response += MOVE_INTERVAL;
|
||||
}
|
||||
if (server.argName(0) == "intensity") {
|
||||
intensity = (byte)server.arg("intensity").toInt();
|
||||
response = "Intensity updated to ";
|
||||
display.setIntensity(intensity);
|
||||
response += intensity;
|
||||
}
|
||||
if (server.argName(0) == "text") {
|
||||
server.arg("text").toCharArray(message, msglen);
|
||||
messageOffset = - chips * 8;
|
||||
response = "Message updated";
|
||||
}
|
||||
if (response == "" ) {
|
||||
response = "invalid parameter";
|
||||
}
|
||||
}
|
||||
Serial.print("Change request: ");
|
||||
Serial.println(response);
|
||||
response = "<html><head><meta http-equiv=\"refresh\" content=\"2; url=/\"></head><body>" + response + "</body></html>";
|
||||
server.send(200, "text/html", response); //Returns the HTTP response
|
||||
}
|
||||
|
||||
|
||||
void updateDisplay() {
|
||||
display.sendSmooth (message, messageOffset);
|
||||
|
||||
// next time show one pixel onwards
|
||||
if (messageOffset++ >= (int) (strlen (message) * 8))
|
||||
messageOffset = - chips * 8;
|
||||
} // end of updateDisplay
|
||||
|
||||
void loop() {
|
||||
|
||||
|
||||
|
||||
// update display if time is up
|
||||
if (millis () - lastMoved >= MOVE_INTERVAL) {
|
||||
updateDisplay ();
|
||||
lastMoved = millis ();
|
||||
}
|
||||
|
||||
// Handle HTTP server requests
|
||||
server.handleClient();
|
||||
|
||||
} // end of loop
|
623
muell.json
Normal file
623
muell.json
Normal file
|
@ -0,0 +1,623 @@
|
|||
[
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "16",
|
||||
"month": "02",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "22",
|
||||
"month": "02",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "24",
|
||||
"month": "02",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "01",
|
||||
"month": "03",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "08",
|
||||
"month": "03",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "10",
|
||||
"month": "03",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "15",
|
||||
"month": "03",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "22",
|
||||
"month": "03",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "24",
|
||||
"month": "03",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "29",
|
||||
"month": "03",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "05",
|
||||
"month": "04",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "07",
|
||||
"month": "04",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "12",
|
||||
"month": "04",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Mi",
|
||||
"date": {
|
||||
"day": "20",
|
||||
"month": "04",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Fr",
|
||||
"date": {
|
||||
"day": "22",
|
||||
"month": "04",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "26",
|
||||
"month": "04",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "03",
|
||||
"month": "05",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "05",
|
||||
"month": "05",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "10",
|
||||
"month": "05",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "17",
|
||||
"month": "05",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "19",
|
||||
"month": "05",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "24",
|
||||
"month": "05",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "31",
|
||||
"month": "05",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "02",
|
||||
"month": "06",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Mi",
|
||||
"date": {
|
||||
"day": "08",
|
||||
"month": "06",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "14",
|
||||
"month": "06",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Fr",
|
||||
"date": {
|
||||
"day": "17",
|
||||
"month": "06",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "21",
|
||||
"month": "06",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "28",
|
||||
"month": "06",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "30",
|
||||
"month": "06",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "05",
|
||||
"month": "07",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "12",
|
||||
"month": "07",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "14",
|
||||
"month": "07",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "19",
|
||||
"month": "07",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "26",
|
||||
"month": "07",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "28",
|
||||
"month": "07",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "02",
|
||||
"month": "08",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "09",
|
||||
"month": "08",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "11",
|
||||
"month": "08",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "16",
|
||||
"month": "08",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "23",
|
||||
"month": "08",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "25",
|
||||
"month": "08",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "30",
|
||||
"month": "08",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "06",
|
||||
"month": "09",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "08",
|
||||
"month": "09",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "13",
|
||||
"month": "09",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "20",
|
||||
"month": "09",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "22",
|
||||
"month": "09",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "27",
|
||||
"month": "09",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Mi",
|
||||
"date": {
|
||||
"day": "05",
|
||||
"month": "10",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Fr",
|
||||
"date": {
|
||||
"day": "07",
|
||||
"month": "10",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "11",
|
||||
"month": "10",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "18",
|
||||
"month": "10",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "20",
|
||||
"month": "10",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "25",
|
||||
"month": "10",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Mi",
|
||||
"date": {
|
||||
"day": "02",
|
||||
"month": "11",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Fr",
|
||||
"date": {
|
||||
"day": "04",
|
||||
"month": "11",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "08",
|
||||
"month": "11",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "15",
|
||||
"month": "11",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "17",
|
||||
"month": "11",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "22",
|
||||
"month": "11",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "29",
|
||||
"month": "11",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "01",
|
||||
"month": "12",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "06",
|
||||
"month": "12",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "13",
|
||||
"month": "12",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Do",
|
||||
"date": {
|
||||
"day": "15",
|
||||
"month": "12",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
},
|
||||
{
|
||||
"tag": "Di",
|
||||
"date": {
|
||||
"day": "20",
|
||||
"month": "12",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Restmuell"
|
||||
},
|
||||
{
|
||||
"tag": "Mi",
|
||||
"date": {
|
||||
"day": "28",
|
||||
"month": "12",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Biomuell"
|
||||
},
|
||||
{
|
||||
"tag": "Fr",
|
||||
"date": {
|
||||
"day": "30",
|
||||
"month": "12",
|
||||
"year": "2022"
|
||||
},
|
||||
"name": "Papier-Tonne"
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue
Block a user