Bluetooth HC-06. Arduino. Send. Receive. Send text file. Multitouch. Image

Hi, I have posted here too some Tutorials about AppInventor and Arduino, maybe can help you. There are analog and digital values

Have you ever been able to get this to work with apple ISO?

Sorry, in Apple ISO I have not tested it.

I have read somewhere else that Bluetooth is not supported yet in Appinventor :confused

App Inventor works with classic Bluetooth (Bluetooth components) and BLE (extension).

Can you change the sliders by a picture or drawing and then let the servos draw the picture or drawing like a draw robot

You can create a Canvas, slide your finger across the screen and send the coordinates via BT.

30A.- Multitouch with Clock. Press several buttons at the same time.

p9A0i_bluetooth_multitouch.aia (5.8 KB)

In this topic we can see several examples of Multitouch:

Let's take the idea from @TIMAI2, using the TouchDown, TouchUp events, and a Clock.

Touch btn_2 and btn_4, add and get 6 decimal, this is 110 binary or 00000110 Byte.
Send this Byte by Bluetooth.

  • Arduino receives this Byte. It splits bit(0), bit(1), bit(2) and bit(3) and RUN motors.

// Juan A. Villalpando

byte byte_received;
String motor;

void setup() { 

void loop() { 
  if(Serial.available()) {
    byte_received =;
   // Serial.println(byte_received, BIN);
   // Serial.println(byte_received, DEC);

void motores(){
if (bitRead(byte_received, 0)){Serial.print("Motor0: RUN  ");} else {Serial.print("Motor0: ---  ");}
if (bitRead(byte_received, 1)){Serial.print("Motor1: RUN  ");} else {Serial.print("Motor1: ---  ");}
if (bitRead(byte_received, 2)){Serial.print("Motor2: RUN  ");} else {Serial.print("Motor2: ---  ");}
if (bitRead(byte_received, 3)){Serial.print("Motor3: RUN  ");} else {Serial.print("Motor3: ---  ");} 


30B.- Multitouch without Clock.

p9A0i_bluetooth_multitouch_noclock.aia (6.1 KB)

  • Now without Clock.

Olá gostaria de saber se teria como informar no app, a medição de um contador de fluxo de água.
Teria como me ajudar?

Open a new topic and show your work, code, drawings, devices used ...

Check example:
8.- App receives data from Arduino. Clock.Interval. Arduino delay. Buffer.

Estou precisando fazer com que no aplicativo comunique com o arduino a partir dessa programação:
#include <LiquidCrystal.h>

float vazao; //Vari√°vel para armazenar o valor em L/min
float media = 0; //Variável para fazer a média
int contaPulso; //Vari√°vel para a quantidade de pulsos
int i = 0; //Vari√°vel para segundos
int Min = 00; //Vari√°vel para minutos
float Litros = 0; //Vari√°vel para Quantidade de agua
float MiliLitros = 0; //Variavel para Convers√£o

LiquidCrystal lcd(8, 7, 6, 5, 4, 3);

void setup() {

lcd.begin(16, 2);
lcd.setCursor( 0, 0);
lcd.print("Sensoriamento de");
lcd.setCursor( 0, 1);
lcd.print(" fluxo de Agua ");

pinMode(2, INPUT);
attachInterrupt(0, incpulso, RISING); //Configura o pino 2(Interrupção 0) interrupção

void loop () {
contaPulso = 0;//Zera a vari√°vel
sei(); //Habilita interrupção
delay (1000); //Aguarda 1 segundo
cli(); //Desabilita interrupção

vazao = contaPulso / 5.5; //Converte para L/min
media = media + vazao; //Soma a vaz√£o para o calculo da media
lcd.setCursor(0, 0);
lcd.print(vazao); //Escreve no display o valor da vaz√£o
lcd.print(" L/min "); //Escreve L/min
lcd.setCursor(0, 1);
lcd.print(":"); //Escreve :
lcd.print(i); //Escreve a contagem i (segundos)
lcd.print("Min "); //Escreve :
MiliLitros = vazao / 60;
Litros = Litros + MiliLitros;
lcd.print("L ");

// Neste conjunto de linhas fizemos a média das leituras obtidas a cada 1 minuto
if (i == 60) {

if (Min >= 60) {
Min = 0;
media = media / 60; //faz a média
Serial.print("nMedia por minuto = "); //Imprime a frase Media por minuto =
Serial.print(media); //Imprime o valor da media
Serial.println(" L/min - "); //Imprime L/min
media = 0; //Zera a vari√°vel media para uma nova contagem
i = 0; //Zera a vari√°vel i para uma nova contagem

void incpulso () {
contaPulso++; //Incrementa a vari√°vel de pulsos

a onde a montagem do circuito é a seguinte

n√£o precisa do LCD, s√≥ preciso com que as informa√ß√Ķes do sensor de fluxo consiga passar a quantidade de litros para o aplicativo

O sensor usado foi o [Sensor de Fluxo de √Āgua G 1/2 1-30 l/min]

E o site usado como base foi o

Por enquanto eu fiz esse aplicativo:

Porem o dados n√£o est√£o sendo mostrados corretamente

Você teria outra solução ou alteração no meu trabalho?

31.- Automatic connection and disconnection cycle of Bluetooth.

p9A01_bluetooth_conec_desco.aia (3.2 KB)

  • Arduino creates random numbers from 0 to 500 continuously and sends them over Bluetooth with a delay of 100 ms.

// Juan A. Villalpando

int value_pot0;

void setup() {

void loop() {
// value_pot0 = analogRead(A0);
value_pot0 = (int) random(0,500);
delay(100); // It should be slower than the Clock Interval.

  • App connects Bluetooth for 5 seconds, during that time it receives data. Disconnect. Stay disconnected for 5 seconds. Repeat the cycle.
    (approximate times).

Clock1.TimerInterval: 5000
Clock2.TimerInterval: 50
BluetoothClient1.DelimiterByte: 10

  • "for each" loop, create a small delay.

32.- Two Bluetooths alternately connect and disconnect cyclically.

p9A01_bluetooth_conec_desco_2.aia (3.4 KB)

In these tutorials we saw how to connect two Bluetooth devices at the same time to the same application, for this we use two components, BluetoothClient1 and BluetoothClient2.

  • Now we are going to connect two Bluetooth to the same application but cyclically, that is, the app connects to a Bluetooth, for 5 seconds during this time it receives random numbers from 100 to 199. It disconnects. It connects to the other Bluetooth for 5 seconds, during that time it receives random numbers from 2000 to 2999. It disconnects. This sequence repeats continuously.

  • We will use a single BluetoothClient1.

  • The two Bluetooth are sending numbers continuously. Look at the Arduino codes. Just change the range of the random numbers.

Code for Arduino 1. (100...199)

// Juan A. Villalpando

int value_pot0;

void setup() {

void loop() {
// value_pot0 = analogRead(A0);
value_pot0 = (int) random(100,199);
delay(100); // It should be slower than the Clock Interval.

Code for Arduino 2. (2000...2999)

// Juan A. Villalpando

int value_pot0;

void setup() {

void loop() {
// value_pot0 = analogRead(A0);
value_pot0 = (int) random(2000,2999);
delay(100); // It should be slower than the Clock Interval.

Clock1.TimerInterval: 5000
Clock2.TimerInterval: 50
BluetoothClient1.DelimiterByte: 10

33.- Two Screens. Screen1 to Connect. Screen2 to view data.

p9A02_bluetooth_dospantallas.aia (5.5 KB)

:eight_spoked_asterisk: For the app to work it must be installed.

  • We can go from one screen to another without losing the connection.

// Juan A. Villalpando

#include <SoftwareSerial.h>
SoftwareSerial BT(2,3);

int number = 0;
String numberS = "0";
char caracter = '0';

void setup(){
void loop(){
  // Send number every 800 ms.
  number = number + 1;
  if(number == 1000){number = 0;}
  numberS = (String) number + '\n';

  // If receive char 'r' by BT, restart number.    
  if(BT.available()) {
    caracter =;
    if(caracter == 'r'){number = 0;}
  • Sketch sends a number by BT every 800 ms: 1 2 3 4 5 6 7 8...
  • If this code receives the character 'r' by BT, the count is reset (number = 0)


  • Screen1 Select and Connect BT.
  • Receives the numbers by BT and store them in a comma separated string in a TinyDB, Always in the ReceiveText tag. 1,2,3,4,5,6,7,8,...
  • Shows all data in Label etq_receive.
  • Button "Open Screen2" open this screen.


  • Screen2 shows in Label etq_receive all data of TinyDB, ReceiveText tag.
  • TinyDB1 is the same on both screens, since they have the same NameSpace.
  • Button: "Send 'r' (by Screen1)", close Screen2 and sends 'r' to Screen1.
  • When Screen1 receive 'r', SendText 'r' by BT to Arduino. Arduino reset (number = 0). Return to Screen2.

Similar to this topic: [Extension] Dynamic graph. Shift left graph. Sinusoidal wave. Bluetooth

hello super tutorial YES !!!, a question: Is it possible to transmit a csv file from the arduino / esp8266 to the mobile? if so what are the constraints?
Thanks for reading.
Happy holidays to you

I just try to get data (voltage) from Arduino. voltage from the photo resistor.

void loop()
int Volt = analogRead(A0);

I can't see any data in MitappInvertor




if BluetClient.Is Connected...... in a ClockTimer

Clock Timerinterval : 400
BluetoothClient.DelymiterByte: 10

Take a look at the examples in this topic.