Post topics, source code that relate to the Arduino Platform

User avatar
By nate4495
#42164 Hello ESP Arduino world.

I have written this code to connect to website via TCP. The module is already connected to wifi

Code: Select allaltSerial.println("AT+CIPMUX=1");
delay(500); 
if(altSerial.find("OK"))   
Serial.println("ready to go");
 
//create string to generate TCP connection
String cmd2 = "AT+CIPSTART=\"TCP\",\"";  //make this command: AT+CIPSTART=1-4 (sometimes ommitted),"TCP","107.180.3.137",80
  cmd2 += DST_IP;
  cmd2 += "\",80";
 
  altSerial.find("OK");
   altSerial.println(cmd2);  //send command to device
delay(1000);
   
     unsigned long t=millis()+3000;
while( t > millis() ) {
while( altSerial.available())   {
char c=altSerial.read();
Serial.print(c);
}  }

Here is Serial output for above code.

Network recognized!
resetting . . . . .ready to go

AT+CIPMUX=1


OK
AT+CIPSTART="TCP","107.180.3.137",80

Link typ ERROR
resetting . . . . .ready to go

AT+CIPSTART="TCP","107.180.3.137",80

Link typ ERROR


It is connecting to the internet perfect, but I cannot get the module to create a TCP connection. I have tried the other syntax ("AT+CIPSTART=4,"TCP","IP",PORT) and also using AT+CIPMUX=0 and will have same problem or no response.

Any ideas??

Thank you :D