5.- Screen1 to connect. Screen2 to view data.
p299H_GraficoDinamico_5.aia (12.6 KB)
The application must be installed
- Screen1 to select and connect Bluetooth.
- Screen2 to view data graphic with an extension.
- We can go from one Screen to another without losing the connection.
Screen1.
Screen2.
// Juan A. Villalpando
// http://kio4.com/appinventor/299H_extension_GraficoDinamico.htm
#include <SoftwareSerial.h>
SoftwareSerial BT(2,3);
String texto = "";
void setup(){
BT.begin(9600);
Serial.begin(9600);
}
void loop(){
// Send random every 800 ms.
delay(800);
texto = (String) random(0,1000);
// Serial.println(texto);
texto = texto + '\n';
BT.write(texto.c_str());
// If receive BT, write.
if(BT.available()) {
Serial.write(BT.read());
}
// If Serial Monitor, send data by BT
if(Serial.available()){
texto = Serial.readStringUntil('\n');
texto = texto + '\n';
BT.write(texto.c_str());}
}
- Sketch sends random every 800 ms. by BT.
- You can write a number on Serial Monitor and send it by BT.
- You can write a text in the app and send it to Arduino by BT (check Serial Monitor).



