In this tutorial we will see how to send a message from the Arduino board to the smarthpone via bluetooth. This is why we are going to create two programs: a mobile application with App Inventor for the smartphone and a program for the Arduino board.
Here is the program that allows you to connect the Arduino card to the smartphone and send a message by bluetooth: if you press the push button, you send the word ‘Hi my name is Arduino card’ to the smartphone.
const int btnPin = A0; // The button is connected to pin A0 of the Adruino board
int btnVal = 0;
if(btnVal<200) // We press the push button
hc06.print("Hi my name is Arduino board "); //Send message to smartphone
We create a mobile application named ‘receive_arduino’ with App Inventor which allows you to receive a message from the Arduino board.
We propose to create the design of the application, with the following visual:
To program the application, App Inventor offers us to use the Blocks space, which allows you to create a program in the form of a block diagram. Very easy to use but requiring a little programming logic.
Here is the program of the application created in the Blocks area of the Inventor App: