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

Slider change?

My project uses different sliders.
each slider must communicate the values 0/1/2/3/4 depending of the position of the slider. So I have set the value of each slider in the settings between between 0 and 4. Value are read by the “param.asInt();” function.

This worked fine.

Now I notice that when I move the slider instead of having the 5 integer values: 0/1/2/3/4 it gives me decimal depending on its position (for example I can put the slider on 1.09…) while I only want it to increment by integer. How can I force it to use only integer values?

I also notice that if I click on the line connecting the min and max output values in the slider property, i get a symbol in a circle in the middle of the line. What is the function of this?

I think you need to use Stepper Widget or Menu widget for selecting between predefined list of values. We just added to slider support of floats, so this changed it previous flow. However, param.asInt(); should return int anyway. Where do you get 1.09?

@BlynkAndroidDev FYI.

1 Like

On the slider itself, so that I cannot properly position it to1 or 2…

http://docs.blynk.cc/#widgets-common-widget-settings-data-mapping

I’ve tried this (on iOS) and I can only put the slider on 0, 1, 2, 3 or 4.

Pete.

Is this just for Android at the moment and what was the reason for adding floats to a slider?

iOS app is not yet supports floats.

User requests. All widgets now supports min/max as floats, this is not only slider change.

No way to implement this as an option?
I am not sure everybody will be happy to have the float values…
Stepper is not as convenient and much more expensive in terms of “energy”
(I use 20 steppers, this means that I will have to rewrite part of the project)

Looks like the widgets that select values, such as the horizontal and vertical sliders, joystick etc need an option to force integer values if needed.

Pete.

Indeed. just tried the Stepper but in now way as good as the slider for my project…

does param.asInt() not return an integer?

Could you please explain why?

Sure, there is always a way. However, I don’t think this is right function for the slider, I may be wrong for sure. But let’s wait for other Blynkers feedback.

No if my stepper is set for instance at 3.57, the arduino does not recognize the value and the state of the controlled machine is not changed.
I use the sliders to control different machines and the slider allows to change and reflects the states for the machine:
0 = not existing
1 = out of order
2= in operation
3= iddle
4= start machine

“No if my stepper” read slider…

The color of the slider change in accordance with the value (state of the machine).

With 20 machines, slider is much more user friendly. To start a machine, you just slide the slider to the right. Also give a much better visual feed back.

I think that a slider, should have “continuous” values exactly like a potentiometer. So float is perfectly fine (but with more precision than two decimals as it is now).
For discrete inputs there are steps and menu IMO.

For state machine the menu is perfect and much better than a slider, also as semantic.

I think Peter is right. It should be optional.
With the slider, it is very easy to see the actual value by the position of the slider.
With the stepper, you only have the value in small character on top of the stepper - not user friendly in my case…

Only for advanced users not regular Blynkers.

I don’t agree, because there are already many options to input discrete and integer values, but no options for float or continuous values.
On the other hand I agree that an option could change the slider int<–>float and make everybody happy :).

Yes slider and probably the most popular.
Nobody wants to use STEP for changing temperature from 12 degrees to 28 degrees.

Slider was an excellent widget for rapid selection of integer values.

1 Like

Hi, I see others have come across the same issue with the last Android update… my house heating controller now is doing 2 decimal places.

Best solution would be to have a Step Size parameter, would suit everyone! :slight_smile: