Hexiwear based rate of exercise coach

Dependencies:   FXOS8700 Hexi_OLED_SSD1351

Fork of Hexi_Accelero_Magneto_Example by Hexiwear

Committer:
maclobdell
Date:
Fri Aug 12 16:08:20 2016 +0000
Revision:
0:207337d58f96
Child:
1:6da908234299
initial

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maclobdell 0:207337d58f96 1 #include "mbed.h"
maclobdell 0:207337d58f96 2 #include "FXOS8700CQ.h"
maclobdell 0:207337d58f96 3
maclobdell 0:207337d58f96 4 DigitalOut led1(LED1);
maclobdell 0:207337d58f96 5
maclobdell 0:207337d58f96 6 // Pin connections & address for Hexiwear
maclobdell 0:207337d58f96 7 FXOS8700CQ fxos(PTC11, PTC10, FXOS8700CQ_SLAVE_ADDR0); // SDA, SCL, (addr << 1)
maclobdell 0:207337d58f96 8 // Storage for the data from the sensor
maclobdell 0:207337d58f96 9 SRAWDATA accel_data;
maclobdell 0:207337d58f96 10 SRAWDATA magn_data;
maclobdell 0:207337d58f96 11
maclobdell 0:207337d58f96 12 // main() runs in its own thread in the OS
maclobdell 0:207337d58f96 13 // (note the calls to Thread::wait below for delays)
maclobdell 0:207337d58f96 14 int main() {
maclobdell 0:207337d58f96 15
maclobdell 0:207337d58f96 16 fxos.enable();
maclobdell 0:207337d58f96 17 while (true) {
maclobdell 0:207337d58f96 18 led1 = !led1;
maclobdell 0:207337d58f96 19 // Example data printing
maclobdell 0:207337d58f96 20 fxos.get_data(&accel_data, &magn_data);
maclobdell 0:207337d58f96 21 printf("A X:%5d,Y:%5d,Z:%5d M X:%5d,Y:%5d,Z:%5d\r\n",
maclobdell 0:207337d58f96 22 accel_data.x, accel_data.y, accel_data.z,
maclobdell 0:207337d58f96 23 magn_data.x, magn_data.y, magn_data.z);
maclobdell 0:207337d58f96 24
maclobdell 0:207337d58f96 25 Thread::wait(500);
maclobdell 0:207337d58f96 26 }
maclobdell 0:207337d58f96 27 }