[Extension] Dynamic graph. Shift left graph. Sinusoidal wave. Bluetooth

Hello friends,

this extension is about drawing a dynamic graph, which scrolls to the left.
sin1

Blocks:

8 Likes

1.- Creation of graph with random values. Shift to the left.

p299Hi_GraficoDinamico.aia (10.7 KB)

3 Likes

2.- Creation of sinusoidal graph. Shift to the left.

p299Hi_GraficoDinamico_2.aia (10.9 KB)

Look at the properties of the extension.
MaxValue: 1000
MinValue: -1000


2 Likes

3.- Arduino. Bluetooth Potentiometer.

p299Hi_GraficoDinamico_3.aia (11.4 KB)

Arduino sends the value of a potentiometer over Bluetooth.

// Juan A. Villalpando
// http://kio4.com/appinventor/299H_extension_GraficoDinamico.htm

int value_pot0;

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

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


4 Likes

4.- Creation of two graphs with random values. Shift to the left.

p299Hi_GraficoDinamico_4.aia (11.4 KB)

Great Extension @Juan_Antonio
:tada:
BTW , is this HC-05 bluetooth module?

Actually if its a HC-05 module it, there is KEY pin :sweat_smile: :joy:, it looks like a different variant of it...

HC-05 and HC-06 here

1 Like

Great job Juan Antonio !!! :hugs: :+1: :muscle:
To do the same I was using a canvas split in two sections (a left one , mirroring the right one) but the effect was not continuous like yours (i.e. such as a scrolling track on an oscilloscope). Thanks a lot: this will be a big improvement in my "digital HUD" for my old convertible.
Cheers, Ugo.

1 Like

(added to FAQ)

Amazing job @Juan_Antonio!
I have implemented similar moving real-time graphs using the timers and recursive draw functions, but this extension would make the process so easier!

5.- Screen1 to connect. Screen2 to view data.

p299H_GraficoDinamico_5.aia (12.6 KB)

:house: 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).
2 Likes

(added to FAQ)