arduino-libraries / Arduino_JSON

Official JSON Library for Arduino
GNU Lesser General Public License v2.1
154 stars 60 forks source link

json array isnt printing in the else loop #25

Closed caster1 closed 3 years ago

caster1 commented 3 years ago

i am trying to add 15 readings of a device and then print it. this is how im doing it


  while (Status[0].devid == 1) {
    if (Status[1].index <= 15) {
      int i = Status[1].index;
      Serial.println("now reading 1 dev param:");
      Serial.print(i);
     Status[1].index = Status[1].index + 1;
         freq[Status[1].index]["_id"] = 1;
          freq[Status[1].index]["parameter"] = c[Status[1].index].param;
          freq[Status[1].index]["value"] = 3;
    }
    else if (Status[1].index>15) {
      Status[0].devid = 2;
      String msg = JSON.stringify(freq);
      //Uart1Println(msg.c_str());
      Serial.println(msg);

    }
  }
  while (Status[0].devid == 2) {
    if (Status[1].index <= 30) {
      int i = Status[1].index;
      Serial.println("now reading 2 dev param:");
      Serial.print(i);
      Status[1].index = Status[1].index + 1;
    }
    else if (Status[1].index > 30) {
      Status[0].devid = 1;
      Status[1].index = 0;
    }
  }```
per1234 commented 3 years ago

Hi @caster1. Thanks for your interest in this open source project. This issue tracker is only to be used to report bugs or feature requests. This topic is more appropriate for the Arduino Forum. I'm sure we'll be able to help you with your problem over there:

https://forum.arduino.cc/