Can anybody help me with my arduino and android programming issue?
I have created an arduino gadget that I control via an app on my android phone that was made in app creator.
the "gadget" is an RGB LED that has the RGB levels controlled by red, green and blue up and down arrows.
they communicate via a serial bluetooth adapter, the app sends a letter via bluetooth "A", "a" etc... and the arduino reads them like so:
if (Serial.available() > 0)
incomingByte = Serial.read();
char character = char(incomingByte);
if (character == 'A')
redLevel += 20;
and then the R, G and B levels are written using analogWrite. It works but it is not great.
my issues are as follows:
to change a colour level, red for example, I have to tap the red arrow multiple times, basically just sending the serial character over and over to change the analog level by 20 each time. Is there a way to do this where I can hold down the button and the level will fade? I am pretty sure this has to do with the android app rather than the arduino sketch but I could be wrong...
Also, the analog level cycles, that is to say that when the colour is at it's brightest level, pressing the UP arrow again turns that colour off or if not off back to the lower end of the analog values. I am pretty sure this particular issue is in the arduino code. what can I put in my code that keeps the level at 255 if going up and 0 if going down?
any help appreciated and I will give credit where credit is due when I end up turning this into an instructable.
Thank you very much.