This is clear: in this situation you call the FastLED.show() only when you receive a new character. If the Serial.available() is false you don't enter neither the switch/case nor you do the FastLED.show, so it runs only once (i.e. only at every new character).
while :
this happens because you dont' wait to have a new character to execute the FastLED.show(), so this function executes suddenly at every loop() repetition..
Hmmmm... I suppose that the FastLED.show() is a library function and you don't have the code isn'it ? Because if within this function there is a NoInterrupt() call, the SoftwareSerial could be foolished and could loose characters. So: let's try again to use the HW serial (the one used by the Monitor) instead of the SoftwareSerial. so connect the HC05 to pins 1 & 2 (thw HW serial pins) and try to put a delay as the first instruction of the loop() function.
Like:
void loop()
{
int i;
for (i =0, i< 100; i++) delaymicroseconds(500);
........................................
}
The HW serial should not be affected by delay() or NoInterrupt(), but to be on the safe side, allowing 50ms at every tourn of loop() should leave enough time to the UART to receive and decode a BT received character. By using delaymicroseconds in a loop, will allow interrupt to happen.(instead fo using a typical delay(50)). After having had a look to my aia, please try also this solution.
Kind regards, Ugo.
I downloaded this, but I can't find any 7zip or ino.
I have load the RGB BT.aia in the MIT App Inventor. I can identify the irrelevant parts, but I can't identify whick blocks are useful for me... which part of the program could bring the decisive solution?
I don't think I'm getting any further here. I can't expect someone to copy the circuit and the codes and programs to really understand the thing.
Maybe I should try a totally new approach. Actually I don't want use WLAN or infrared, there are many other problems again. Anyway, I have to try out or lose my motivations.
At least I thanks for your motivation to help me.
If anyone still find a solution.... I would be happy.
Hello @ber63,
I reckon I've been unclear: you shall open the .aia file with 7zip or winzip (click the right button of the mouse on the .aia and select "open with": the aia file is simply a zipped file). You will find inside that zip a directory called "assets", in this directory is stored the .ino.
here below the .aia opened with 7zip:
I'bve rewritten my apk, and I've renamed it behr63. Now it is containing ONLY the blocks to activate a BT line, and to send characters on the BT when a button is pressed. Nothing else.
Now a question arise: are you sure (100%) that the HC05 works properly ? Otherwise we are running behind the ghosts
What about if you write a simple Arduino code just to receive characters from BT and print them on the monitor ?
A little step at a time ...
Ok, i didn't know that a * .aia file can be a zip file
I found the asset now, thanks.
By the way... I use a HC-06....but I tried also with an HC-05...the behavior is the same.
Otherwise he does everything very well, e.g. when I work with normal LEDs.
In principle, I've already tried that, following the tip from you and Juan above. but i will follow your advice and make it very simple and understandable, then I can understand it better myself too (I'am only a LLL... low level layman )
Hello @ber63,
don't be so sad !!!
Normally in the SW problems the solution is just a 0 or a 1 ....
Sure HC06 and HC05 are the same (HC06 honestly is easier to interface, but it doesn't matter).
But when you say the with normal LED's it's working, this means that you have troubles only when you use the FastLed.show() ? Probably the cause of malfunction is embedded in that part of code. As I told you yesterday, are you sure that somewhere there is embedded a NoInterrupt instruction ?
As another hint: instead of calling the FastLED.show() try to put a "stub" instead. I mean: put a normal LED and switch it on when your "case" recognizes a command, and switches it off when another character is recognized (i.e. button 1 = ON; button 2 = OFF).
If everything works well, this means that the "worm" is inside the FastLED.show() function.
Stay tuned.
Ciao, Ugo.
Hello all,
I tried again to find a solution.
I left the Arduino code as above.
But i used the app "Serial Bluetooth Terminal" for debugging.
First in this app I set the send mode to None, this is necessary in the SW Monitor too in order to work.
When I using this bluetooth app happens the same like my MIT App Inventor app. It works sporadic.
If I look at the Serial Monitor from the Arduino IDE, I see.... sometimes no data comming in (no reaction on the led stripe) or it comes in a mirrored question mark (the animation stopps). Only if the correct number comes in switched the animation.
Looks like it is due to the HC-06 or the communication to the Arduino Nano. Maybe also at the Arduino library.
I think that this forum is then not the right one.
If someone has an idea anyway ... I am receptive.