inexth / arduino-esp8266_libs Goto Github PK
View Code? Open in Web Editor NEWLibrary that make easy to using ESP8266 Serial WiFi Module (Available only TCP now)
Library that make easy to using ESP8266 Serial WiFi Module (Available only TCP now)
I noticed that there is hardReset function in the base cpp file. Where you set the pin high and low how is this schematic supposed to look like on the esp chip.
i try to use connectAP (wifi looping connection) but the wifi does not work.
But if i remove the connectAP the wifi works.
i think the reset did not work well.
`/*
*
*/
SoftwareSerial SerialESP(2,3);
// ESP8266 Class
ESP8266_TCP wifi;
// Target Access Point
// Connect this pin to CH_PD pin on ESP8266
void setup()
{
delay(3000);
// We use Serial1 to interface with ESP8266
// and use Serial to debugging
Serial.begin(9600);
SerialESP.begin(9600);
wifi.begin(&SerialESP, &Serial, PIN_RESET);
/* If your board has only 1 serial port
or you didn't need to debugging, try this.
*
Serial.begin(115200);
wifi.begin(&Serial, PIN_RESET);
*
*/
// Check that ESP8266 is available
if(wifi.test())
{
// Connect to target Access Point
String ip = connectAP();
// but if remark this the wifi works, somethig like this
// //String ip = connectAP();
// so the reset did not work, maybe they use the old configuration
// Open TCP Server on port 2000 and 30 seconds for connection timeout (Max 2880)
wifi.openTCPServer(2000, 7200);
}
else
{
// ESP8266 isn't available
Serial.println("Check module connection and restart to try again...");
while(true);
}
}
void loop()
{
// Check for any data has coming to ESP8266
int dataState = wifi.isNewDataComing(WIFI_SERVER);
if(dataState != WIFI_NEW_NONE)
{
if(dataState == WIFI_NEW_CONNECTED)
{
// Connected with TCP Client Side
Serial.println("Status : Connected");
}
else if(dataState == WIFI_NEW_DISCONNECTED)
{
// Disconnected from TCP Client Side
Serial.println("Status : Disconnected");
}
else if(dataState == WIFI_NEW_MESSAGE)
{
// Got a message from TCP Client Side
Serial.println("ID : " + String(wifi.getId()));
Serial.println("Message : " + wifi.getMessage());
}
else if(dataState == WIFI_NEW_SEND_OK)
{
// Message transfer has successful
Serial.println("SENT!!!!");
}
}
}
// Access Point Connection Function that you can loop connect to Access Point until successful
String connectAP()
{
String ip = "0.0.0.0";
while(ip.equals("0.0.0.0"))
{
ip = wifi.connectAccessPoint(ssid, pass);
if(!ip.equals("0.0.0.0"))
{
break;
}
}
return ip;
}
`
anyone can help me?
regards
Hi,
This is venkat,Please ,I would request you to clear one of my doubt.i was using the following library for communication
https://github.com/INEXTH/Arduino-ESP8266_libs
Server is created and when i am starting server to make communication between them iam getting the following error which was marked.
AT+CIPSTART=(4)("TCP"),("192.16ΓΈ.4.1"),(80)
Link typ ERROR
I am doing these commuinication using two esp8266 with two arduino boards.
Hi, I try send a lo of messages to the ESP8266 through TCP Java Sochet, but I lost many messages if i send the messages quickly.Can I change this?
Thanks
how to reconnect TCP connection automatically?
i try to use timeout 7200 seconds (2 hours) its ok, but if i use more than 7200 seconds times make it wrong.
actually in the esp8266 datasheet maximum we can use 28800 seconds timeout so why goes error.
the soultion maybe we must reconnect TCP connection automatically after 7200 seconds max.
anyone can help me.
regards
Thanks
I am unable to send messages after making a successful connection through this function. But when i use the AT command from Serial Monitor it works perfectly. Can you please check?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.