Sourcen zu verschiedenen MCU
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

114 lines
3.0 KiB

#include "WiFi.h"
#include <WiFiS3.h>
#include "ESPASyncWebServer.h"
#include "Arduino_LED_Matrix.h"
#include "arduino_secrets.h"
char ssid[] = SECRET_SSID;
char pw[] = SECRET_PASS;
byte frame_horizontal[8][12] ={
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 },
{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 },
{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 },
{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 },
{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 },
{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 },
{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 },
};
byte frame_vertical[8][12] ={
{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, },
{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, },
{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, },
{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, },
{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, },
{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, },
{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, },
{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, },
};
ASyncWebserver server(80);
void debug(char * msg, char *var) {
Serial.print(msg);
Serial.println(var);
}
void setup() {
Serial.begin(9600); // initialize serial communication
// check for the WiFi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}
String fv = WiFi.firmwareVersion();
if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
Serial.println("Please upgrade the firmware");
}
long count = 0;
// attempt to connect to WiFi network:
int status = WL_IDLE_STATUS;
while (status != WL_CONNECTED) {
debug("trying to connect to ",ssid);
status = WiFi.begin(ssid, pw);
// Serial.print("status =");
// Serial.println(WiFi.status());
char scount[10];
sprintf(scount, "%d", count);
debug("Retry count: ", scount);
count++;
// wait 10 seconds for connection:
delay(1000);
}
Serial.println("erzeuge Server");
server.begin(); // start the web server on port 80
printWifiStatus();
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
int paramsNr = request->params();
Serial.println(paramsNr);
for(int i=0;i<paramsNr;i++){
AsyncWebParameter *p = request->getParam(i);
Serial.print("Param name: ");
Serial.println(p->name());
Serial.print("Param value: ");
Serial.println(p->value());
Serial.println("------");
}
}
request->send(200, "text/plain", "message received"); // you're connected now, so print out the status
}
void loop() {
}
void printWifiStatus() {
//SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print your board's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
// print where to go in a browser:
Serial.print("To see this page in action, open a browser to http://");
Serial.println(ip);
}