Hi This is my first time using Arduino for a school project. I am working on dimming a LED panel using PWM pins on Arduino Uno and I have a problem in my code. I was able to dim it using analogWrite(light, 127) automatically. However what I want is to dim it using an App that was created using MIT app inventor.
The app has 4 buttons (100%, 75%, 50%, and 25%) for each I want to use (analogWrite(light, 255), analogWrite(light, 191), analogWrite(light, 127), analogWrite(light, 64)) respectively. When I used an if statement the analogWrite didn’t function and when I tried digitalWrite it worked but its only setting it high or low. The app is sending a text “1” or “2” “3” and so on to the bluetooth module HC-06.
Is there a way I can use analogWrite for these four stages? and can you please explain how or walk through the steps.
Thank you in advance
I have attached the Arduino code it is very simple and the MIT app code