I am new to Blynk and just discover the power of this app !
I plan to use it to manage my Escape Game room. I already add wifi to all my arduino and now I can control everything within a second from the app.
But I would like to go further ! I plan to create riddle, using the map, by giving player a smartphone or a tablet.
I have already done things with buttons and segmented switch.
I would also like to make the player use sliders, for example, to set fake temperature of something, set value of fake things …
But I need to be able to read this value to make something from it.
Let say, the slider goes from 0 to 100, which could be 0°C to 100°C and I would like to know if the slider is between different areas 0-25 or 26-50 or 51-75 or 75-100.
How can I get this value ? Since its supposed to be PWM …
I don’t undertstand the PWM comment, but you use the BLYNK_WRITE(Vxx) function to get the value of the slider. The function is alutomatically triggered when the value of the slider changes.
BLYNK_WRITE(sliderVpin)
{
//reads the slider value when it changes in the app
SliderValue = param.asInt();
}
You’d follow this (probably in the same function) with a Switch Case statement on SlideValue that had the parameters you wnated 0…25, 26…50 etc.
By PWM, I mean that the slider widget is sending only 0 and 1 (but a certain amount of time, to provides a analogic value from 0 to 255) so I was doubting about being able to “read” it.
Using BLYNK_WRITE(Vxx) I can get a SliderValue of 125 for example if the slider is on 125 ?
The widget doesn’t do any 0 and 1 PWM stuff, it just sends the value. You can choose to read this as a variety of variable types, but for what you’ve described an integer is best so the param.asInt option is what you’d need to use.