BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Is it possible to get (not to set) min and max properties of widgets?

#1

Hi. I want to store some value and its range on blynk server. The position and range (in min/max property) are kept in value display widget (because I don’t know another method to store a simple value at server). Anyway, the position value is incrementing hardware-side and I need to check if it is out of this range or not. I don’t want to use two additional text widgets, and I want to have an ability to change this range, so it shouldn’t be hardcoded at hardware.

0 Likes

Reset widget color to original after calling setProperty("color")
#2

You can set the min/max properties by code, but I don’t think you can read them.
The only way to return these values is via an API call, which returns the whole definition for the project as a Json string. The format is documented here:
https://blynkapi.docs.apiary.io/#reference/0/qr-for-project-cloning/get-project
but making the API call from within your sketch and parking the results would be messy.

I presume from your description that the user(s) are stopping the project, editing the min/max values of the widget and re-starting the project?

I think I’d probably handle this in a different way…
I’d add two step widgets, one for the min value and one for the max. I’d probably put these on an ‘admin’ tab. When the values of these widgets change you’ll get a BLYNK_WRITE(VPin) notification from the server to your hardware, which can then be used to set the min/max properties of the widget that you’re currently using. Your sketch will then know these values.
If you want to load the values at startup then do a Blynk.syncVirtual(VPin) on the virtual pins used by the step widgets.

Pete.

0 Likes

#3

Yes, you’re right.
Thank you for reply and the method you proposed. I’ll take it into account. So pitty, that the simple readProperty ability or smth is not introduced…

0 Likes