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: FXAS21002
Fork of Hexi_gyro_app by
Revision 1:d26e406e92f9, committed 2016-08-15
- Comitter:
- GregC
- Date:
- Mon Aug 15 23:33:04 2016 +0000
- Parent:
- 0:b0767be19223
- Commit message:
- Gyroscope program example for Hexiwear
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b0767be19223 -r d26e406e92f9 main.cpp
--- a/main.cpp Fri Aug 12 16:25:02 2016 +0000
+++ b/main.cpp Mon Aug 15 23:33:04 2016 +0000
@@ -6,7 +6,8 @@
* https://developer.mbed.org/teams/ATT-Hackathon/code/Accel_Mag_Gyro_SensorStream_K64F_AGM01_M/
*/
-DigitalOut led1(LED1);
+DigitalOut led1(LED_GREEN);
+Serial pc(USBTX, USBRX);
// Pin connections for Hexiwear
FXAS21002 gyro(PTC11,PTC10);
@@ -22,9 +23,9 @@
while (true) {
gyro.acquire_gyro_data_dps(gyro_data);
- printf("G %4.2f,\t%4.2f,\t%4.2f\r\n",gyro_data[0],gyro_data[1],gyro_data[2]);
+ pc.printf("Roll (G) %4.2f,\t Pitch (G) %4.2f,\t Yaw (G) %4.2f\r\n",gyro_data[0],gyro_data[1],gyro_data[2]);
gyro_rms = sqrt(((gyro_data[0]*gyro_data[0])+(gyro_data[1]*gyro_data[1])+(gyro_data[2]*gyro_data[2]))/3);
- printf("G RMS %f \n",gyro_rms);
+ pc.printf("Gyroscope RMS %f \r\n\n",gyro_rms);
led1 = !led1;
Thread::wait(1000);
