#include #include void setup() { PhyphoxBLE::start("My Device"); //Experiment PhyphoxBleExperiment PlotAcc; PlotAcc.setTitle("Acceleration Plotter"); PlotAcc.setCategory("Arduino Experiments"); PlotAcc.setDescription("Plots acceleration measured by the Arduino card's sensors"); //View PhyphoxBleExperiment::View firstView; firstView.setLabel("FirstView"); //Create a "view" //Graph PhyphoxBleExperiment::Graph firstGraph; firstGraph.setLabel("X Acceleration over time"); firstGraph.setUnitX("s"); firstGraph.setUnitY("g"); firstGraph.setLabelX("time"); firstGraph.setLabelY("X acceleration"); /* Assign Channels, so which data is plotted on x or y axis * first parameter represents x-axis, second y-axis * Channel 0 means a timestamp is created after the BLE package arrives in phyphox * Channel 1 to N corresponding to the N-parameter which is written in server.write() */ firstGraph.setChannel(0,1); PhyphoxBleExperiment::Graph secondGraph; secondGraph.setLabel("Y Acceleration over time"); secondGraph.setUnitX("s"); secondGraph.setUnitY("g"); secondGraph.setLabelX("time"); secondGraph.setLabelY("Y acceleration"); secondGraph.setChannel(0,2); PhyphoxBleExperiment::Graph thirdGraph; thirdGraph.setLabel("Z Acceleration over time"); thirdGraph.setUnitX("s"); thirdGraph.setUnitY("g"); thirdGraph.setLabelX("time"); thirdGraph.setLabelY("Z acceleration"); thirdGraph.setChannel(0,3); firstView.addElement(firstGraph); //attach graph to view firstView.addElement(secondGraph); firstView.addElement(thirdGraph); PlotAcc.addView(firstView); //Attach view to experiment PhyphoxBLE::addExperiment(PlotAcc); //Attach experiment to server if (!IMU.begin()) { while (1); } } void loop() { float accx, accy, accz; if (IMU.accelerationAvailable()) { IMU.readAcceleration(accx, accy, accz); PhyphoxBLE::write(accx, accy, accz); } }