Using the slider as setpoint for the code

Hi,

In the settings of the slider you can only connect it to one of the analog pins, how to connect the slider to a software point in the code like setpoint??

Check the examples in the library for Virtual Pins. Send Data example

You can configure the slider to a virtual pin to pass values to variables in your project using BLYNK_WRITE which is in the example code from “Send Data from app to hardware”.

Also, how do you set the default value of the slider?

There might be other ways but if the slider is assigned to a virtual pin you could use blynk.virtualwrite to set the pin to a default value.

ok thanks, but sorry to be a pain, but is this how i’d do it?


BLYNK_WRITE(V30) // set max temp for air inlet
{
  BLYNK_LOG("Got new setMaxTemp value: %i", setMaxTemp = param.asInt());
  Blynk.virtualWrite(V30, 28); // the 28 is the maximum on the slider range, i want it to be set to 28, not 0 on every start-up
  autoVentLogic();
}

but it goes back to 0 when i reset the hardware, which is not even in the 16-28 range i have set V30 to?

PLUS - the slider is really sensitive - when i slide it, it makes like 4 to 6 readings show up on the serial monitor,

this causes it to logout?

[443450] Login timeout
[443450] Connecting to cloud.blynk.cc:8442
[445280] Ready (ping: 0ms).

@Dave1829 have you tried syncing the slider as that should retain the set values. There is a bug in the current slider which is being fixed relating to it resetting to zero. Not sure if it is just with iPhone or also with Android.

The sensitivity of the slider is a pain and personally I think Blynk should provide a coding fix. The name and appearance of the widget suggests sliding would be a good idea but as you have found it invariably crashes your system if you use it in this way. I tend to ‘dab’ to new slider positions rather than slide the ‘slider’ and this helps.

I believe it was @Lichtsignaal that suggested a user fix with millis() i.e. ensure readings are only taken at say 300 millisecond intervals to stop the flood crash. Certainly a workaround but not ideal.

there is no send data example in the library, there is PushData example only.

@m_swalha I think it might actually be called Get Data rather than Send Data.

The comments for this example include:

App dashboard setup:
Slider widget (0…100) on V1