[SOLVED] my bridge only stores one single key/value pair

hello

I tried several things but I still have the same behavior: I would like to store a set of values in the data store in order to access it via the REST API.

I succeed in retrieving one key/value pair, the first I "put", but it looks like the others are not stored and I dont understand why.

my code:

void bridge_setup() {
  Bridge.begin();
}

void bridge_loop() {
  unsigned long currentMillis = millis();

  if (currentMillis - last_check > BRIDGE_REFRESH_RATE) {
    last_check = currentMillis;

    Bridge.put("eC", String(eC));
    Bridge.put("eC2", String(eC));
    Bridge.put("eC3", String(eC));
    Bridge.put("eC4", String(eC));
    delay(1000);
    

  }
}

arduino.local/data/get gives:

{
  "value": {
  "eC": "-0.14"
},
"response": "get"
}

arduino.local/data/get/eC gives:

{
  "value": "-0.14",
  "key": "eC",
  "response": "get"
}

arduino.local/data/get/eC2 gives:

{
  "key": "eC2",
  "response": "get"
}

Please post your entire code. What you have looks correct, so there is probably something going on elsewhere in the sketch. Sometimes it can be something really subtle.

One question: why are you using the "no delay" method of controlling your update rate, and then also using a delay() statement? Usually, one uses one or the other, not both.

hello shapeshifter,

thanks for your answer. for the delay, you are right I was desperatly trying something, but the delay() call is not needed at all.

something new today: I tried a simple Bridge example found on internet and it worked perfectly. then you are right the problem comes from elsewhere in my code. I cannot post it it's quite big on several files.

indeed I think the problem might be a lack of memory or smthg like this. do you think it is possible ? the compilation says 54% of program storage space and 36% for global variables.

another information, I added some debug prints, and it looks like the program is blocking within the Bridge.put() function. it never print the dedug line after the call. that's why it only puts one key/value pair.

do you think about smthg ?

another difference with the example sketch is that the value I need to bridge.put is a float

greenchap:
indeed I think the problem might be a lack of memory or smthg like this. do you think it is possible ? the compilation says 54% of program storage space and 36% for global variables.

There is a huge amount of programming space waiting to be used on the Linux side of your Yun.

...R

hello robin, shapeshifter,

yes I know but i did not know where to look for...

anyway my problem is solved but i dont like this way of solving things: i commented the block of code that was managing my I2C LCD and the bridge.put worked for all may pairs.

and even stranger: when i uncommented it, it still worked...

thank you for your answers anyway.

cheers