Bluetooth Plotter

The Bluefruit App has a built in plotter that will let you easily visualize data from your microbit! Be sure you got the UART examples working from earlier.

Install Library & Example Code

First up, install the Adafruit helper library and friends

You can find our BLE demos in the examples menu:

Load up the BLE Plotter demo

This time, in the App, select the Plotter module. You will be able to see the X, Y and Z data appear and scroll down!

You can plot anything you like, just use bleSerial.print() and print out your data with commas in between. At the end of a data set have a bleSerial.println() and it will plot each comma-separated-element as a unique graph

So if you want to just graph the total acceleration vector sqrt(x^2 + y^2 + z^2), use this code snippet:

void loop() {
  bleSerial.poll();

  accel.update();

  // print the data on serial port
  Serial.print(accel.getX());    Serial.print(", ");
  Serial.print(accel.getY());    Serial.print(", ");
  Serial.println(accel.getZ());

  float vector = (accel.getX() * accel.getX()) + (accel.getY() * accel.getY()) +  (accel.getZ() * accel.getZ());
  vector = sqrt(vector);

  // send it over bluetooth
  bleSerial.println(vector);

  delay(100);
}
Last updated on 2017-09-27 at 01.05.00 PM Published on 2017-12-06 at 04.57.43 PM