I can't communicate my Arduino with my app

Let's think out loud about the requirements:

  1. Person in distress can push a button on the Arduino, which sends a signal via Bluetooth to a paired Smartphone.

  2. This signal also changes the colour of an LED on the Arduino Box.

  3. The signal changes the colour of a button in the App (I suggest it should also play a sound).

  4. The Smartphone User can push the button in the App to switch off the Alert.

  5. When the Smartphone button is pushed, it sends a signal back to the Arduino Box and switches off the LED to indicate that someone has received the signal and will attend the person in distress.

Is that how your Project should work? If not, write a step-by-step as I have done here.

1 Like

OMGGGG THAT'S IT, you read my mind lol

This is exactly what I want, but I'm not getting it.

@ChrisWard

Create a basic application to send an app information to Arduino with HM-10.
Then another basic application to send information from the HM-10 to the app.
Here examples:

But then in the tutorial he is using the hm-10 separately, I have the hm-10 next to the shield, and in the arduino code he is declaring the RX and TX ports, in my case I don't know if I need to declare

Arduino and HM-10 must be connected.
I don't know how they are connected in your shield.
HM-10 has two data terminals TX and RX, you need to locate those terminals and check which terminals on the Arduino they are connected to.
In my examples they are connected to pins 2 and 3 of the Arduino.

@Sett_Lima

Here an example:

1 Like

I just found out that my arduino's TX and RX inputs are 0 and 1, I was able to use the second example from your site successfully, however, when I went to test the button example, I press the button and it doesn't turn red , only green, but on the serial monitor it appears that I am sending it to the app, but even so the color does not change in the app

Sett - one step at a time!

I also tested the example of the 3 leds and I was successful, the problem was only the example of the button. Of the 3 examples that I tested, the one that declared SoftwareSerial BLE1 in the arduino code was the one that I didn't succeed.

You need to be specific in your descriptions. I assume here you mean the App button did not change colour to red?

Yeah he hasn't changed

Sett, are you using a Sketch from Juan now or are you still using Martyn's?

Also, I notice that UUIDs for characteristics are used by the App code. That would normally require the same UUIDs to be defined in the Arduino Sketch, and 'Advertised' on Bluetooth. It could just be a means to an end on the App side and only Serial comms used between the App and Arduino.

for now i'm using juan's sketch and the app too

OK - check all of your wiring, ensure it matches Juan's, and make sure the pin numbers match in the Sketch.

It's late here, I have some sleeping to do :grin:

Change the jumpers to connect the hm-10 to terminals 2 and 3

#include <SoftwareSerial.h>
// El TXD del módulo al pin 2 (RX) del Arduino.
// El RXD del módulo al pin 3 (TX) del Arduino.
SoftwareSerial BLE1(2, 3);

I got Juan :grin:, now how do I join this button and a led? I would also like to turn the led on and off through the app, as if it were an alert, when the person pressed the button, a led would light up and it also looked like a notification on the cell phone and the alert would only disappear when I turned it off on the cell phone

App inventor does not work with Services, the app must always be active in the foreground.
There are extensions you can try to work with services, but you'll need to test them.
There are also extensions to create Notifications.
To turn on an LED from the app, you can use the examples that I have put in the HM-10 tutorial.

pinMode(7,INPUT);
pinMode(13, OUTPUT);

Serial.println("Pulsado");
digitalWrite(13,HIGH);

Serial.println("NO");
digitalWrite(13,LOW);

I think my problem has already been solved, but I only have two more questions

  • Where do I download the kio04 extension

  • and finally if it would be possible to change the message when I press the button, instead of being 0 or 1 in the app I would like it to be another type of message like "nobody is calling now" or "they need help" is it possible?