m5atom-wifi-ex03
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[Real2Virtual202111]]
#code(c){{
/*
m5atom-wifi-ex03 by Takashi Yamanoue,
Based on the WiFiAccessPoint.ino
Created for arduino-esp32 on 04 July, 2018
by Elochukwu Ifediora (fedy0)
*/
#include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiAP.h>
#include "M5Atom.h"
//#include <SoftwareSerial.h>
#define LED_BUILTIN 2 // Set the GPIO pin where you con...
// Set these to your desired credentials.
const char *ssid = "YAMA-ATOM5-EX01";
const char *password = "12345678";
/*
IPAddress ip(192,168,4,2);
IPAddress gateway(192,168,4,1);
IPAddress subnet(255,255,255,0);
IPAddress DNS(192,168,4,1);
*/
WiFiServer server(23);
//Serial1 mySerial(22,19); //rx, tx
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200);
Serial.println();
Serial.println("Configuring access point...");
// WiFi.config(ip,gateway,subnet,DNS);
// You can remove the password parameter if you want th...
WiFi.softAP(ssid, password);
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
server.begin();
Serial.println("Server started");
Serial2.begin(9600,SERIAL_8N1,22,19);
Serial2.println("Server started, serial1");
}
void loop() {
WiFiClient client = server.available(); // listen for...
if (client) { // if you get...
Serial.println("New Client."); // print a m...
String currentLine = ""; // make a Str...
while (client.connected()) { // loop while...
if (client.available()) { // if there's...
char c = client.read(); // read a byt...
Serial.write(c); // print it o...
Serial2.write(c);
if (c == '\n') { // if the byt...
// if the current line is blank, you got two ne...
// that's the end of the client HTTP request, s...
if (currentLine.length() == 0) {
} else { // if you got a newline, then clear...
currentLine = "";
}
} else if (c != '\r') { // if you got anything e...
currentLine += c; // add it to the end of ...
}
}
if(Serial.available()){
char c= Serial.read();
Serial2.write(c);
client.write(c);
}
if(Serial2.available()){
char c=Serial2.read();
Serial.write(c);
client.write(c);
}
}
// close the connection:
client.stop();
Serial.println("Client Disconnected.");
}
}
}}
----
#counter
終了行:
[[Real2Virtual202111]]
#code(c){{
/*
m5atom-wifi-ex03 by Takashi Yamanoue,
Based on the WiFiAccessPoint.ino
Created for arduino-esp32 on 04 July, 2018
by Elochukwu Ifediora (fedy0)
*/
#include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiAP.h>
#include "M5Atom.h"
//#include <SoftwareSerial.h>
#define LED_BUILTIN 2 // Set the GPIO pin where you con...
// Set these to your desired credentials.
const char *ssid = "YAMA-ATOM5-EX01";
const char *password = "12345678";
/*
IPAddress ip(192,168,4,2);
IPAddress gateway(192,168,4,1);
IPAddress subnet(255,255,255,0);
IPAddress DNS(192,168,4,1);
*/
WiFiServer server(23);
//Serial1 mySerial(22,19); //rx, tx
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200);
Serial.println();
Serial.println("Configuring access point...");
// WiFi.config(ip,gateway,subnet,DNS);
// You can remove the password parameter if you want th...
WiFi.softAP(ssid, password);
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
server.begin();
Serial.println("Server started");
Serial2.begin(9600,SERIAL_8N1,22,19);
Serial2.println("Server started, serial1");
}
void loop() {
WiFiClient client = server.available(); // listen for...
if (client) { // if you get...
Serial.println("New Client."); // print a m...
String currentLine = ""; // make a Str...
while (client.connected()) { // loop while...
if (client.available()) { // if there's...
char c = client.read(); // read a byt...
Serial.write(c); // print it o...
Serial2.write(c);
if (c == '\n') { // if the byt...
// if the current line is blank, you got two ne...
// that's the end of the client HTTP request, s...
if (currentLine.length() == 0) {
} else { // if you got a newline, then clear...
currentLine = "";
}
} else if (c != '\r') { // if you got anything e...
currentLine += c; // add it to the end of ...
}
}
if(Serial.available()){
char c= Serial.read();
Serial2.write(c);
client.write(c);
}
if(Serial2.available()){
char c=Serial2.read();
Serial.write(c);
client.write(c);
}
}
// close the connection:
client.stop();
Serial.println("Client Disconnected.");
}
}
}}
----
#counter
ページ名: