HC-05 Bluetooth. Arduino. Change baud rate 38400. Send random to app

2.- Arduino with the HC-05 Bluetooth module sends two random numbers to the app.

p9A0i_bluetooth_aleatorios_V2.aia (3.3 KB)

const unsigned long interval= 3000;
unsigned long previousMillis;
unsigned long currentMillis;

String send_this;

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

void loop() {
 currentMillis = millis();
 if (currentMillis - previousMillis >= interval){
   float t = random(0,10000) / 100.0;
   float h = random(0,10000) / 100.0;

   send_this = String(t,2) + "," + String(h,2);
   Serial.println(send_this);
   previousMillis = millis();
 }
}
  • App Inventor. Blocks.

- Screenshot.

5 Likes