Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: I2C_FUNCTION LSM6DS0 MAX30100 mbed BLE_API
Diff: main.cpp
- Revision:
- 0:285a4bb14ae3
- Child:
- 2:4cac3109599d
diff -r 000000000000 -r 285a4bb14ae3 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun Apr 03 13:43:54 2016 +0000
@@ -0,0 +1,43 @@
+#include "mbed.h"
+#include "functions.h"
+#include "lsm6ds0.h"
+
+static Serial pc(SERIAL_TX, SERIAL_RX);
+
+InterruptIn LSM6DS0_int(D4);
+DigitalOut led(LED1);
+LSM6DS0 *gyro_accel;
+xl_output data_FIFO[FIFO_length_by_five];
+int offset;
+
+char data_read[192];
+
+void get_data() {
+ LSM6DS0_int.disable_irq(); //Disable IRQ interrupt
+ led = !led; //Blink led
+ gyro_accel->storeFIFO(&offset, data_FIFO); //Store the data from FIFO to data_FIFO variable
+ LSM6DS0_int.enable_irq(); //Re-enable IRQ interrupt
+}
+
+int main()
+{
+ LSM6DS0_ACC_ODR_t odr;
+ LSM6DS0_ACC_HR_t high_res;
+ LSM6DS0_FIFO_mode_t work_mode;
+
+ offset = 0; //Offset in the data_FIFO vector. It is useful to store the FIFO value in the data_FIFO vector without overwritting (after 5 FIFO value the data_FIFO vector has been overwritten)
+ odr = LSM6DS0_ACC_ODR_50Hz ;
+ high_res = LSM6DS0_ACC_HR_Disabled;
+ work_mode = LSM6DS0_FIFO_mode_CONTINUOUS;
+
+ LSM6DS0_int.rise(&get_data); //LSM6DS0's interrupt initializzation
+ gyro_accel->LSM6DS0_reset(); //LSM6DS0 reset
+ gyro_accel->Init(odr, high_res, work_mode); //LSM6DS0 initializzation
+
+ while(1)
+ {
+ wait(5);
+ pc.printf("\n\r#################################\n\r");
+ gyro_accel->computeValue(data_FIFO);
+ }
+}
\ No newline at end of file