Activate a Void Function from MIT App Inventor through bluetooth

the below block is the update

OK. There are so many errors across your code its difficult for me to tell you what to fix :upside_down_face:

Let me just write some basic code for you to try.

okay thanks alot, but usually the value is comes out but the led is doesnt turn on

Post your Sketch here (rename it from .ino to .txt)

Here is a Project, the blocks of which you can merge into your own Project. It uses a Clock Timer to send the data to Arduino.

led.txt (1.4 KB)

OK, I have made a simple Sketch which you can try out. I can't test it here unfortunately.

If it does run but too fast, increase the Clock Timer interval in the App and the loop timer in the Sketch. The Sketch time should be about 20% faster than the App time to prevent any overlap of execution.

ledBasic.txt (971 Bytes)

Emm i have seen your file and try it, It does not work, because i do have my pin tx and rx on 7 and 8. that is why there is 2 serial which transferred the pin

Ok, just rename my Serial Calls to your Software Serial name.

How did it go Daniel?

emm i have the problem before, but there is a new problem where the data from mit app inventor that goes to arduino from; if the text is 10, it will read 1 and 0 is there a way i can read it 10 by sending a number not a text to arduino?

I think the issue is that you are reading as a char? You can send integers, floats and bytes but text is most common. It's important that the type from App Inventor is the same as the type expected by the Arduino Script. Experiment!

yea i have try to send1byte using text and number in the variable but still not work

Have you got any other App + Arduino project to work or is this your first?

this is my first on apps

In this Community there are many examples of App Inventor + Bluetooth + Arduino.

1 Like

OK, try this basic pair of App + Sketch (App sends to Arduino, Arduino sends to Serial Monitor on PC via USB)

BT_Basic_Setup_Send.aia (8.5 KB)

SendToArduino.txt (810 Bytes)

i guess it different from mine

There are many ways to achieve the same thing. The methods I gave you are simple and effective, but if something fails you need to capture the error message so that we can use that as the first clue to what is wrong.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.