AT commands

Hello,

I am having a compilation problem in regards to AT commands which include multiple commas and speech marks.

This is the code I have written.

#include <SoftwareSerial.h>

const byte rx = 7 ;
const byte tx = 8 ;

SoftwareSerial myserial(rx, tx);

void setup()
{
  myserial.begin(115200); //Initialize virtual serial port
  Serial.begin(115200); //Initialize Arduino default serial port

  gsm_setup() ;
  
  
  
}

void loop() {
  Serial.println("Sending an AT command...");

  } 
  
void gsm_setup() {

    myserial.println("ECHO") ; // Removes ECHO
    delay(500) ;
    myserial.println("AT+CPIN=0000") ; // Entres SIM PIN No
    delay(10000) ;
    myserial.println("AT+CGDCONT=1,"IP","orange"") ; // Connect to ORANGE APN
    delay(5000) ;
    myserial.println("AT+NETOPEN") ; // Opens network
    delay(1000) ;
    myserial.println("AT+CIPOPEN=1","TCP","172.111.250.41","666") ; // Connect to VPN TCP Server
    delay(5000) ;
    myserial.println("AT+CIPSEND=0,5") ; // Send 5 characters
    delay(5000) ;
    myserial.println("READY") ; // Send ready
    delay(1000) ;
    myserial.println("0x1a") ; // Ctlr + Z to send message
    delay(1000) ;
    
}

And the error messages I get are the following:

C:\Users\mateusz.winter\OneDrive - RIOU GESTION\Beehive\Code\GSMTEST\TEST\TEST.ino: In function 'void gsm_setup()':

TEST:30:39: error: inconsistent user-defined literal suffixes 'IP' and 'orange' in string literal

     myserial.println("AT+CGDCONT=1,"IP","orange"") ; // Connect to ORANGE APN

                                       ^~~~~~~~~

TEST:30:48: error: unable to find string literal operator 'operator""IP' with 'const char [15]', 'unsigned int' arguments

     myserial.println("AT+CGDCONT=1,"IP","orange"") ; // Connect to ORANGE APN

                                                ^~

TEST:34:65: error: no matching function for call to 'SoftwareSerial::println(const char [13], const char [4], const char [15], const char [4])'

     myserial.println("AT+CIPOPEN=1","TCP","172.111.250.41","666") ; // Connect to VPN TCP Server

                                                                 ^

In file included from C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Stream.h:26:0,

                 from C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/HardwareSerial.h:29,

                 from C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Arduino.h:233,

                 from sketch\TEST.ino.cpp:1:

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:77:12: note: candidate: size_t Print::println(const __FlashStringHelper*)

     size_t println(const __FlashStringHelper *);

            ^~~~~~~

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:77:12: note:   candidate expects 1 argument, 4 provided

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:78:12: note: candidate: size_t Print::println(const String&)

     size_t println(const String &s);

            ^~~~~~~

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:78:12: note:   candidate expects 1 argument, 4 provided

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:79:12: note: candidate: size_t Print::println(const char*)

     size_t println(const char[]);

            ^~~~~~~

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:79:12: note:   candidate expects 1 argument, 4 provided

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:80:12: note: candidate: size_t Print::println(char)

     size_t println(char);

            ^~~~~~~

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:80:12: note:   candidate expects 1 argument, 4 provided

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:81:12: note: candidate: size_t Print::println(unsigned char, int)

     size_t println(unsigned char, int = DEC);

            ^~~~~~~

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:81:12: note:   candidate expects 2 arguments, 4 provided

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:82:12: note: candidate: size_t Print::println(int, int)

     size_t println(int, int = DEC);

            ^~~~~~~

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:82:12: note:   candidate expects 2 arguments, 4 provided

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:83:12: note: candidate: size_t Print::println(unsigned int, int)

     size_t println(unsigned int, int = DEC);

            ^~~~~~~

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:83:12: note:   candidate expects 2 arguments, 4 provided

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:84:12: note: candidate: size_t Print::println(long int, int)

     size_t println(long, int = DEC);

            ^~~~~~~

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:84:12: note:   candidate expects 2 arguments, 4 provided

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:85:12: note: candidate: size_t Print::println(long unsigned int, int)

     size_t println(unsigned long, int = DEC);

            ^~~~~~~

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:85:12: note:   candidate expects 2 arguments, 4 provided

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:86:12: note: candidate: size_t Print::println(double, int)

     size_t println(double, int = 2);

            ^~~~~~~

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:86:12: note:   candidate expects 2 arguments, 4 provided

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:87:12: note: candidate: size_t Print::println(const Printable&)

     size_t println(const Printable&);

            ^~~~~~~

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:87:12: note:   candidate expects 1 argument, 4 provided

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:88:12: note: candidate: size_t Print::println()

     size_t println(void);

            ^~~~~~~

C:\Users\mateusz.winter\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/Print.h:88:12: note:   candidate expects 0 arguments, 4 provided

exit status 1
inconsistent user-defined literal suffixes 'IP' and 'orange' in string literal

If you need to include speech marks in the output you need to escape them by preceding them with a \ character

What should the output from

myserial.println("AT+CIPOPEN=1","TCP","172.111.250.41","666") ; // Connect to VPN TCP Serveractually look like ?

Hi HeliBob good to hear from you again,

Basically what it should do is AT+CIPOPEN=0,“TCP”,“172.111.250.41”,666 then return to send the command.

Hope it answers the question

Try this

void setup() 
{
  Serial.begin(115200);
  while(!Serial);
  Serial.println( "AT+CIPOPEN=0,\"TCP\",\"172.111.250.41\",666");
}

void loop() 
{
}

I get no errors on that line now but now I get an error with myserial.println("AT+CGDCONT=1,"IP","orange"") ; // Connect to ORANGE APN

I would assume from your modification it would be like myserial.println("AT+CGDCONT=1,"IP","orange"") ; is that correct?

Once that is sold I will try and it and get back to you

I would assume from your modification it would be like myserial.println("AT+CGDCONT=1,"IP","orange"") ; is that correct?

Try it in my example program so that you can see what it is doing

If you need to include speech marks in the output you need to escape them by preceding them with a \ character

It works fine now.

Thanks!