Change LED brightness

Hi, I am experiencing issues with the "slider " in thunkable.
The thing is, I am trying to create a project that use my own app on the phone to control the brightness of a LED bulb that connects to arduino through bluetooth. my idea is to use slider to control the brightness. The slider value range is set from 0 to 255, and I already successfully make my app connect to the HM-10 BLE module, but the issue is, my slider is not controlling the led. Can any one help me to debug this slider issue please ?

1 Like

Hi @john271737miht1p

I see that for the data input your are using Light1.getValue and in Label2 you are simply using the “value” from the onValueChange event.

You also seem to be doing rounding in the latter, but not the former.

To start with the troucleshooting, can you confirm if you can use buttons to send 0 and 255 to to turn the LED on/off?

Thanks

2 Likes

I am making a new app to test it by giving numbers only . I will let you know.

Hello, I tried to build a brand new app that use only single number to control the led on and off, and it worked.

2 Likes

Can you please continue to help me with the slider issue please ?

Add a slider and app variable. Set the slider max to = 255
Min= o

Step = 25.5

Remove the “round” math block

On slider value change, set variable as value

Use that variable instead of the from light1 get value block here as you have shown.

Or move this green value block here and try it

So I should use 2 sliders to control one led ?

can you try this one?

2 Likes