Sending SMS with two global variables


I’m using a circuit with arduino, bluetooth and GPS module. When the user presses a push button, the arduino sends “0” to the application via bluetooth (as shown in the block diagram). Upon receiving this, the application sends the character “G” to the arduino, which symbolizes that the arduino must send the data from the GPS module to the application. I know you can use the app’s GPS, but I need to use an external GPS module. The information I want to send is a google maps link.

However, when trying to gather the SMS data asking for help + the google maps link to say where the person is, it does not send and gives an error.
I can send SMS if I fill in the SMS component information within the “Designer” instead of “Blocks”. I think there must be some mistake when using global variables.
Can someone help me?

What error do you receive?

Generic failure: message not sent.

Potential problems @Igor_Castilho :

  • length of the join SMS + GPS The total length of the text of the sms can only be 170 characters plus spaces. A longer message than 170 characters will abort.

  • placing the Texting1.SendMessageDirect as you coded uses the Clock to send the message. If you send too frequently you probably will have issues.

Here is a discussion where a developer is attempting something similar that might be of interest to you . His GPS information is not from the Android’s internal GPS receiver but a microcontroller.; which seems to be what you expect to do.


1 Like

My question is, is it possible to send the SMS using global variables as I tried to do in the block diagram?

The SMS GPS message does not exceed 170 characters. In fact, as a test, I tried to send the message by joining the SMS and a test word (“https”) assigned to the GPS variable. In this case, I tried to send: “HELP, I need help and I’m in this place:” + “https”, that is, it does not exceed 170 characters.

If I create another clock, to receive the GPS value, will it work? A clock to send the distress message and another clock to send the maps link.

Yes ... using a join Block with variables should be OK. It really depends on the contents of your actual GPS and SMS variables.

Will what work? Try it and tell us.

Developers can send a maps link. Clicking on the maps link in the text message will not display a Google Map in the phone user's browser. Clicking on the map link and a display used to be the response. It appears no longer possible for your Android to elicit a browser with the map image (possibly because of Google security issues), at least on some Android OS. I may have a work around later.

These code snippets work to send sms messages when used with a LocationSensor on the Android


So, I want the message to be sent automatically (when the bluetooth module sends a control signal to the app, like number 0). I don’t want the user to have to click a button on the app. So I tried to use the clock, understand?

Yes, I understand what your problem is about. I do not know how to use your Bluetooth device the way you want to Igor. Perhaps someone else will have an idea to auto-send the information. I cannot test your code. I don’t have your Bluetooth device. Get the sms part to work with a Button, then try a Clock. Get those cases to work, then find an auto solution. You have to experiment.

How you can send the GPS geocoordinates using a clickable link in your text that will display a map
in the user’s Android: