Post topics, source code that relate to the Arduino Platform

User avatar
By tolson
#973
admin wrote:What we should be doing here is first, making AT+ command **ALL** behave the same... and then when writing drivers say for Arduino, then its a know command + response, we should work on a common command set and response.....


I agree. An AT+ command set should return consistant success and error messages/codes. The current AT+ commands each really needs to have it's own dedicated procedure. Maybe the library can hide all that and present the user with a consistant front end. Perhaps this is what you are suggesting. Otherwise don't we need to be involved with the firmware developers of the ESP modules?

Without a library, I have written an example telnet daemon like sketch. The pin assignements are specified for the RFduino RGB shield.
http://thomasolson.com/PROJECTS/BLE/RFduino/WIFI/
User avatar
By Akexorcist
#1005
Samighi11 wrote:I am CWLAP, RST and a few others (I have not address +IPD yet) return multiple lines. I would like to merge the library I am working on with many others, just need some ideas on how serial read (and wait) are being handled. (not this is WIP and the "20" tries is just a test). it appears to work fast and clean, getting the expected results (WIP)

Code: Select allString  ESP8266::sendAndWait(String AT_Command, char *AT_Response, uint16_t wait) {
        serial.println(AT_Command);
        Serial.println("Sending " + AT_Command);
        String str = "";
        unsigned long time1 = millis();
        for (int i=0;i<20;i++) {
           while (Serial1.available()) {
                  str = str + serial.readString();                 
        }
        if (str.indexOf(AT_Response) == -1)
           delay(300);
        else
           break;
       }
       Serial.print("Serial port returned" + str);
   
        if (str.indexOf(AT_Response) == -1)
           return "Not OK";
        else
          return "OK";
}



Maybe you need to waiting for reading with some timeout for these command
Code: Select allserial.println(AT_Command);
Serial.println("Sending " + AT_Command);
String str = "";
unsigned long time1 = millis();
unsigned long timeout = 500;
while(serial.available() == 0);
while(millis() - time1 < timeout) {
  if(serial.available()) {
    str = str + serial.readString();
    time1 = millis();
  }
}
...
...


Please check this code again. I didn't check this code.
User avatar
By cyborgmax
#1799 Hello everyone,
This is a great library and very well done. Have anyone tried this with more than one command??
I'm trying to run two examples as once, configuring AP and TCP Server, and it will only execute one of them. However, All examples run perfectly on their own.
Is anyone beyond this point??
Is there any wiki for this library??

I really hope I can use it.

Thanks,

and Great Job!!!
User avatar
By prozac
#1819 Yes. I have had to make some mods, but I have this lib connecting, opening a service port and receiving and sending traffic. It is receiving the data and processing, but my issues are mostly related with the sending of data and checking to make sure that the packets were sent before trying again. There isn't very good feedback from the ESP.
Also, beware of the state table in this library. It does some things in the main loop for server and client using if/elseif/else where, for each read cycle, it will only parse on commands response and chuck the rest of the buffer. This really hurts when a client connects and sends and both the "connected" and first "+IPD" messages show up in the same read request. The state gets set to connected, but the first packet is discarded. Likewise if you are reading IPD packets and the remote client disconnects, you will chuck that, your state stay "connected" and you will timeout trying to send responses. If I get some time I am going to try to clean it up by doing a proper line-by-line read out the buffer to capture all commands.