Trouble with Application for reading arduino value on smartphone

Hello, I am a beginner with App Inventor and Arduino.
I made an app with app inventor to read an analog value from the arduino with my phone. But I have trouble viewing the value on my app when I run my arduino code. I don't know where the problem is. Can you help me please

This is my code arduino:

int in = A0;

void setup() {
Serial.begin(9600); //Set the baud rate of the comunication
mySerial.begin(9600); // Initialiser le port bluetooth
pinMode(in,INPUT); //Define the pin as input

void loop() {
//Read the analog value
float val = analogRead(in);

//Divide by 205 to obtain a range from 0 to 5V
float val2 = val/205;

//Use serial.print to send the data in a "text" format
delay(400);//Small delay between each data send

-I show the value on monitor of arduino and then use the app to read the value
This I my app interface and block:

- When I launch my application I cannot see the value in label3. This is an image of my app in my phone when I launch it

-And when I connect to Bluetooth module I have the label 3 which must print the value that disappear

  • List item

I am not convinced that your Arduino is sending anything at all out on BlueTooth.

Can you find a BlueTooth terminal app that can listen to and display a BlueTooth data stream, to verify that data is being transmitted, independent of your AI2 code?

as @ABG said, your Arduino code isn't sending anything (if you posted all of your Arduino code).
If you intend to use mySerial to send the data on the BT, be aware that in your code you are using the Serial line, instead.
And that's the line used to send data to the Arduino monitor (i.e. the PC).
Then, are you using the SoftwareSerial library ? Therefore you have to initialize which are the pins used to manage the Tx and the Rx (typically pins 2,3 or 10,11 on a UNO Board). Which Arduino board are you using ?
More: are you using a HC06 or HC05 or a BLE shield ? And to which pins is it connected ?
Take also a look to the various tutorials you can find on the community about the use of string terminators: if you use the receive text on AI2 then you shall use the println() as the last character sent by Arduino. This instruction sends a CRLF (0x0D 0x0A) and the LF (0x0A) is the typical terminator expected by AI2.
In a nutshell, there are so many things that need to be done.: sorry for being so rude, but since you are a beginner in both systems (Arduino & AI2) , I suggest you to do a search of one of the many tutorials to clarify youself before to try a big-bang solution.
Per aspera ad astra, any you will have success :muscle: :muscle: :muscle:

Thanks for your answer @ABG , I thought if I just send the data to the arduino monitor, the Bluetooth module could retrieve it afterwards.
Yes I have the Bluetooth Terminal HC-05 application to test the arduino code for the Bluetooth module by sending from the monitor (but it's not the same thing it's when I write something on the serial monitor that I send it) and also receive on the monitor some data but I don't know if it will work, if I just send data from my serial monitor.
It's by this code:

#include <SoftwareSerial.h>
#define rxPin 11
#define txPin 10
#define baudrate 9600

SoftwareSerial mySerial(rxPin,txPin);

void setup() {



void loop() {
int i =0;
char someChar[32] = {0};

while (Serial.available()) {
someChar[i++] =;
}while (Serial.available()>0);



while (mySerial.available()) {
This code works when I send and receive data I try to put this in my code and see how it works.

@uskiaraThanks for your reply, I am using HC-06 and I am using pin 10 and 11 for rx and tx respectively. And I am using the SoftwareSerial library for communication and Arduino Uno.
I will see the part about using the chain on the terminators too. I don't understand everything about it and it will be helpful.
Thank you.

as I told you yesterday there are many tutorials made by the community.
One of the most clever guys, @Juan_Antonio (, has written a huge library of samples.
Please take a look to this link:
App Inventor pide temperatura al Arduino. Sin reloj. readStringUntil. Bluetooth.

Whole his site is a treasure chest :slight_smile:
Happy Easter.