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.
main.cpp
00001 #include "mbed.h" 00002 #include "FXAS21002.h" 00003 00004 /* Check out the full featured example application for interfacing to the 00005 * Gyro device at the following URL 00006 * https://developer.mbed.org/teams/ATT-Hackathon/code/Accel_Mag_Gyro_SensorStream_K64F_AGM01_M/ 00007 */ 00008 00009 DigitalOut led1(LED1); 00010 00011 // Pin connections for Hexiwear 00012 FXAS21002 gyro(PTC11,PTC10); 00013 // Storage for the data from the sensor 00014 float gyro_data[3]; float gyro_rms=0.0; 00015 00016 00017 // main() runs in its own thread in the OS 00018 // (note the calls to Thread::wait below for delays) 00019 int main() { 00020 00021 gyro.gyro_config(); 00022 while (true) { 00023 00024 gyro.acquire_gyro_data_dps(gyro_data); 00025 printf("G %4.2f,\t%4.2f,\t%4.2f\r\n",gyro_data[0],gyro_data[1],gyro_data[2]); 00026 gyro_rms = sqrt(((gyro_data[0]*gyro_data[0])+(gyro_data[1]*gyro_data[1])+(gyro_data[2]*gyro_data[2]))/3); 00027 printf("G RMS %f \n",gyro_rms); 00028 00029 led1 = !led1; 00030 Thread::wait(1000); 00031 } 00032 } 00033
Generated on Thu Jul 14 2022 00:05:28 by
1.7.2