Configure SIM800H HTTP functionalities + a reading issue

Hello everyone,

I encounter 2 little impediments in my GSM quest :stuck_out_tongue:

So, the first one is about HTTP. I'm trying to configure some HTTP functionalities but nothing really work.

Here is my serial monitor :

> 
> OK
> AT+CMGF=1
> OK
> 
> Call Ready    //Boring URC
> AT+HTTPINIT
> OK
> 
> SMS Ready    //Boring URC
> AT+HTTPPARA="CID",1
> OK
> AT+HTTPPARA="URL","http:\\www.google.com"
> OK
> AT+HTTPACT    //truncated answer... 
> OK
> 
> +CPIN: READY    //Boring URC
AT+HTTPINITAT+HTTPPARA="CID",1    //wtf
> AT+HAT+HTTPACTION=0    //well
> OK    //I doubt

So before I try anything with HTTP I must solve my second problem : How can I get better reading results ?
I tryed to follow this nice tutorial : Serial Input Basics - updated - Introductory Tutorials - Arduino Forum

Here is my code :

#define SIM800_RESET_PIN 77
#define PWKEY 6
const byte nbChars = 64;
char receivedChars[nbChars];
boolean newData = false;
String commandStringGSM;
String url = "http:\\\\www.google.com";
void setup() {
  Serial.begin(9600);
  Serial1.begin(9600);

  pinMode(SIM800_RESET_PIN, OUTPUT);
  pinMode(PWKEY, OUTPUT);
  digitalWrite(PWKEY, HIGH);
  delay(1000);
  digitalWrite(SIM800_RESET_PIN, LOW);
  delay(100);
  digitalWrite(SIM800_RESET_PIN, HIGH);
  delay(2000);



}

void loop() {
      
      delay(2000);
      // Network registration
      commandStringGSM = "AT+CREG=1";
      Serial1.println(commandStringGSM);
      delay(50);
      readFromGsm();     
      showNewData();
      delay(500);
      
      // Set text mode
      commandStringGSM = "AT+CMGF=1";
      Serial1.println(commandStringGSM);
      delay(50);
      readFromGsm();
      showNewData();
      delay(500);


      // Init HTTP service
      commandStringGSM = "AT+HTTPINIT";
      Serial1.println(commandStringGSM);
      delay(50);
      readFromGsm();     
      showNewData();
      delay(500);

      

      // Init HTTP service
      commandStringGSM = "AT+HTTPPARA=\"CID\",1";
      Serial1.println(commandStringGSM);
      delay(50);
      readFromGsm();     
      showNewData();
      delay(500);

      // Init HTTP service
      commandStringGSM = "AT+HTTPPARA=\"URL\",\"" + url + "\"";
      delay(100);
      Serial1.println(commandStringGSM);
      delay(100);
      readFromGsm();    
      showNewData();
      delay(500);

      
      // Start the session
      commandStringGSM = "AT+HTTPACTION=0";
      Serial1.println(commandStringGSM);
      delay(50);
      readFromGsm();     
      showNewData();
      delay(500);      

      // Start the session
      commandStringGSM = "AT+HTTPREAD";
      Serial1.println(commandStringGSM);
      delay(50);
      readFromGsm();     
      showNewData();
      delay(500);
   
      // Read HTTP status
      commandStringGSM = "AT+HTTPSTATUS";
      delay(100);
      Serial1.println(commandStringGSM);
      delay(100);
      readFromGsm();     
      showNewData();
      delay(500);
}


void readFromGsm(){

    static byte ndx = 0;
    char endMarker = '\n';
    char rc;
    delay(200);
    while(Serial1.available() > 0 && newData == false && (receivedChars[ndx] != '\n' || receivedChars[ndx] != '\r')){
    
        rc = Serial1.read();
        if (rc != endMarker){
          receivedChars[ndx] = rc;
          ndx++;
          if (ndx >= nbChars) {
            ndx = nbChars -1;
          }
        }else {
            receivedChars[ndx] = '\0'; // terminate the string
            ndx = 0;
            newData = true;
        }
    }
}

void showNewData(){
    if (newData == true) {
        Serial.print("> ");
        Serial.println(receivedChars);
        newData = false;
    }
}

I have no idea what i'm doing wrong in my reading function...
Unfortunately the GSM.h library for GSM shield doesn't work with my arduino DUE and my SIM800h so I guess I have to configure my module alone with some commands... The way i'm trying here ?

Thank you !

Don't start a new thread for the same topic send data to GSM using a web interface - #5 by Niconnexion - Networking, Protocols, and Devices - Arduino Forum

ieee488:
Don't start a new thread for the same topic.

This is absolutly not the same topic, in my first topic I was looking for a technical solution, some tools...
And we talked about MQTT which is such a really cool stuff but before doing that I really need to perform this HTTP request and i'm not using the same libraries, i'm not asking the same question... Here i'm asking why is my serial monitor so broken and what do i do wrong in my reading function.

But if you really want me to move this topic in my first topic I still can do it, but why :o
I think you read a bit too fast..

What I see is a person floundering like a fish out of water around trying to do something.

Try to give some coherent thought to what it is that you want to do exactly.

Thanks for the lesson.

I see what you mean, that's a bit harsh.
The fish has trouble breathing out of water and you ask it to give some coherent thought.
But yes, the fish should probably splash and wabble a little less. It surely have to try to stop moving but no way.

He is making waves with his tail because he miss the sea, and he hope someone will help him to go back to home.

Anyway.. should I re-post on my first topic or should I explain my wide project here ?