I have a sketch where on the Arduino side, I pass an array of values over the bridge to the Linux side using:
for loop { // send array of (playerID, score)
Bridge.put(key,value);
}
To access these variables from the browser, in my javascript file I use:
$.get('/data/get', function(response){ // gets everything in the data buffer
// code to process response object containing (playerID, score) array values
}
I have a momentary push button that I use as a 'clear' button. Once pressed, the global variables in my arduino sketch are cleared, however I'm unsure how to clear the data stored on the bridge. This is causing problems for me as even though I press the clear button, my browser still displays artefacts from the last run-through.
For example:
If I send: (1,2), (3,4), (5,6)
The browser retrieves and displays: (1,2), (3,4), (5,6)
// I then press the clear button
Then I send: (1,7), (5,9)
The browser then retrieves and displays: (1,7), (3,4), (5,9)
I've tried calling Bridge.begin() again, since I read that it has code which is supposed to terminate the bridge and clear out the data. However this didn't work for me and the old data was still seen.
Using client.flush() doesn't help either (it only applies to data that hasn't been read yet by the client side).
I don't want to re-upload my sketch, nor do I want to power cycle etc.
I read that I could use the call:
/data/delete
I guess I'd run this on the client side? Would I run this as a $.put command?
Sorry about how all over the place this ask is. I'll try my best to clarify anything that's unclear.