I thought it would be convenient to use a Dashboard to calibrate a thing I've been working on. 32 servo motors need to be calibrated individually, each with an open value and a closed value. But since the final thing won't work online all the time, the final calibrated values need to be hard coded. So I want to copy paste data listings from the dashboard to my sketch.
The dashboard looks like this:
I have a Messenger widget there, and I can use a String variable, which shows nicely, if I fill the variable with "1, 2, 3,\n4, 5, 6,". But this shows up in the dashboard as an image, not as text. So I can't copy-paste from there.
When I look at the variable in Things in the cloud, I see this:
From here, I can copy-paste, but I have no line breaks here.
Am I missing something here? Is there another widget I could use, that actually presents data that can be copy-pasted, as tables? Or has the Cloud simply missed a crucial tool for development?
As a workaround, I'll probably add my own line break character, then I copy-paste the string to a text editor capable of replacing characters with line breaks, before I finally paste the list as hard coded values.
Hi @Johan_Ha. The "Value" widget does allow you to copy the content as text. However, unlike your string-based approach with the "Messenger" widget, the "Value" widget can only show one value at a time, so it might not be convenient in this specific use case where you need to export 64 values.
A better solution will be to use the "download historical data" feature:
https://docs.arduino.cc/arduino-cloud/features/iot-cloud-historical-data/
You might actually find this more convenient since there is surely a way to use a spreadsheet program to automatically manipulate the raw data from the downloaded file into the format you need to paste into your sketch code.
That looks good. I got this:
I'll build the list using the Messenger widget. I'll add a button for updating the list. I just have to update each time I take a pause. And download what I have so far, and paste it into the code and re-compile.
I switched from Messenger to Value. I noticed that Value can take a String variable as the cloud variable to follow.
BUT, there seems to be a 256 byte buffer somewhere, which restricts the size of the listing. My lines are max 10 characters long, including the \n and I seem to get only 23 lines. If my String object is longer than that, nothing is outputted. I'd need to output 320 byte as text. I guess I need to do it in two separate Value widgets.
And I can copy-paste from the Value widget, as long as the variable is a read-write variable.
Now it works:
What I get from this is an array[32][2] of ints. And I can copy-paste directly from the two widgets into my code to be re-hardcoded. Each line takes 14 bytes, each window holds 16 entries, so I might have 2 spare bytes for each line, but I won't push it.
Conclusion
You can use the Value widget for data lists that can be copy-pasted, if you link the widget to a String object and
- the string length is less than 256
- the String object is read/write
EDIT
I asked Copilot. I had a short chat and my last question was this:
It's really scary how AI reads minds. It's like it searched and found this thread. Not only that. I was also thinking about an overhead, which prevented me from pushing towards the 256 byte size. And now Copilot did the same reasoning.