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

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
// http://kio4.com/appinventor/9A0_Resumen_Bluetooth.htm

byte byte_received;
String motor;

void setup() { 
 Serial.begin(9600);
}

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

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: ---  ");} 
Serial.println();
}

oooooooooooooooo000000000000000000oooooooooooooooooo

30B.- Multitouch without Clock.

p9A0i_bluetooth_multitouch_noclock.aia (6.1 KB)

  • Now without Clock.