-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DataLoggingNextGenTest is suitable for testing MICROBIT_LOG_MODE 2
- Loading branch information
1 parent
95dba76
commit 2ba8f3a
Showing
3 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include "MicroBit.h" | ||
#include "Tests.h" | ||
|
||
// Requires MICROBIT_LOG_MODE value 2 | ||
// Sample data for nextgen data logging for testing the MicroBitLog mode. | ||
// Actual next gen data uses a custom HEX build in | ||
// https://github.com/microbit-foundation/adl-recognition/ | ||
const char* sample = \ | ||
"movement_level,acceleration_mean,model_prediction,model_label1,model_label2,model_label3,model_label4,model_label5,model_label6,model_label7,metadata_key,metadata_value\n" | ||
",,,,,,,,,,version,1\n" | ||
",,,,,,,,,,row_interval_ms,1000\n" | ||
",,,,,,,,,,display_mode,full\n" | ||
",,,,,,,,,,model_version,6\n" | ||
",,,,,,,,,,dev_mode,1\n" | ||
",,,,,,,,,,start,7851\n" | ||
"0,1030\n" | ||
"1,1109\n" | ||
"1,1087\n" | ||
"0,1075\n" | ||
"2,1510,2,27,816,11,144,0,0,0\n" | ||
"2,1536\n" | ||
"2,1479\n" | ||
"2,1789\n" | ||
"1,1261\n" | ||
"2,1593,1,746,0,187,66,0,0,0\n" | ||
"0,1017\n" | ||
"2,1411\n" | ||
"2,1788\n" | ||
"2,1507\n" | ||
"1,1286,1,828,19,148,7,0,0,0\n" | ||
"1,1271\n" | ||
"1,1147\n" | ||
"0,1036\n" | ||
"0,1036\n" | ||
"0,1036,2,0,996,0,0,0,0,0\n" | ||
"0,1036\n" | ||
"0,1036\n" | ||
"0,1036\n" | ||
"0,1037\n" | ||
"0,1036,2,0,996,0,0,0,0,0\n" | ||
",,,,,,,,,,end,37451\n"; | ||
|
||
|
||
void data_logging_timeseries_next_gen() | ||
{ | ||
while (1) | ||
{ | ||
if (uBit.buttonA.wasPressed()) | ||
{ | ||
uBit.display.scroll("L"); | ||
uBit.log.logString(sample); | ||
} | ||
if (uBit.buttonB.wasPressed()) | ||
{ | ||
uBit.display.scroll("C"); | ||
uBit.log.clear(false); | ||
} | ||
uBit.sleep(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "MicroBit.h" | ||
#include "Tests.h" | ||
|
||
void data_logging_timeseries() | ||
{ | ||
uBit.log.setTimeStamp(TimeStampFormat::Seconds); | ||
bool logging = false; | ||
while (1) | ||
{ | ||
if (uBit.buttonA.wasPressed()) | ||
{ | ||
uBit.display.scroll("L"); | ||
logging = true; | ||
} | ||
if (uBit.buttonB.wasPressed()) | ||
{ | ||
uBit.display.scroll("C"); | ||
logging = false; | ||
uBit.log.clear(false); | ||
} | ||
if (uBit.log.isFull()) | ||
{ | ||
uBit.display.scroll("F"); | ||
logging = false; | ||
} | ||
if (logging) | ||
{ | ||
uBit.log.beginRow(); | ||
uBit.log.logData("x", uBit.accelerometer.getX()); | ||
uBit.log.logData("y", uBit.accelerometer.getY()); | ||
uBit.log.logData("z", uBit.accelerometer.getZ()); | ||
uBit.log.endRow(); | ||
uBit.sleep(250); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters