From caf251e70652039b5f64eb9a3b594674f1da5646 Mon Sep 17 00:00:00 2001 From: dragonprevost Date: Tue, 13 Nov 2018 19:38:14 -0800 Subject: added rough example to readme --- readme.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/readme.md b/readme.md index 64b1b05..08eac0b 100644 --- a/readme.md +++ b/readme.md @@ -48,6 +48,32 @@ requires: ## Example +For getting a list of impact information you may follow this example. +``` +double x_arr [array_size]; +double y_arr [array_size]; +double z_arr [array_size]; +uint64 timestamps[array_size]; + +// Fills arrays with x, y, and z acceleration that have been recorded at each impact. + +le_result_t result = getSuddenImpact(x_arr, y_arr, z_arr, timestamps); + +for (int i = 0; i < array_size; i++) + LE_INFO("X: %d - Y: %d - Z: %d - time: %ul", x_arr[i], + y_arr[i], + z_arr[i], + timestamps[i]); +``` +For receiving the current acceleration only + +``` +double x_val; +double y_val; +double z_val; +le_result_t result = getCurrentAcceleration(x_val, y_val, z_val); +LE_INFO("Current Acceleration: X: %d - Y: %d - Z: %d"); +``` -- cgit v1.2.3