Adafruit Industries, Essential service and business: NYC – Executive Order 202.6 - Read more.
0

Set a slider block to initial value from sketch
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

Set a slider block to initial value from sketch

by JackTheSE on Wed Feb 19, 2020 7:31 am

EDIT: Never mind. I needed to add myio.run(); after the save command. Now it works...
I have a feed set up in a group and reference it from my sketch using
AdafruitIO_Feed *SliderFrzrPtr = myio.feed("todd-fridge.freezer-cal");
I use that feed and a slider block to set a calibration value for a temp sensor. In the call back routine for the feed I have the line
CalValue = data->value();
where CalValue is a global String variable. I save CalValue to SPIFFS. Upon a restart of the ESP32 I'm using, I read in the saved value from SPIFFS into CalValue, and I would like to make sure the slider is set to that initial value on the dashboard. I've tried the command SliderFrzrPtr->save(CalValue); but it doesn't change the slider position at all. Is it possible to do this? What am I doing wrong?

JackTheSE
 
Posts: 27
Joined: Wed Jan 02, 2019 8:34 pm

Please be positive and constructive with your questions and comments.