![](/media/cache/group/hexiweare_logo_main_black.jpg.50x50_q85.jpg)
Advanced gyroscope program example for Hexiwear featuring OLED Display
Dependencies: FXAS21002 Hexi_OLED_SSD1351
Fork of Hexi_Gyro-v2_Example by
This project demonstrates the use of the FXAS21002CQ Gyroscope sensor embedded in Hexiwear
Compile the project and copy the binary "Hexi_Gyro-V2_Example_HEXIWEAR.bin" in the DAP-LINK drive from your computer file explorer Press the K64F-RESET button on the docking station to start the program on your board
The Roll, the Pitch and the Yaw values will be displayed in real-time on the OLED Display.
Diff: main.cpp
- Revision:
- 1:6bd53a378639
- Parent:
- 0:2ebb70d2b0d9
- Child:
- 2:a041eec9ea8f
diff -r 2ebb70d2b0d9 -r 6bd53a378639 main.cpp --- a/main.cpp Sat Sep 24 19:19:42 2016 +0000 +++ b/main.cpp Sat Sep 24 19:51:05 2016 +0000 @@ -56,30 +56,42 @@ textProperties.alignParam = OLED_TEXT_ALIGN_LEFT; oled.SetTextProperties(&textProperties); + /* Display Legends */ + strcpy((char *) text,"Roll"); + oled.Label((uint8_t *)text,5,67); + /* Format the value */ sprintf(text,"%i",x); /* Display time reading in 35px by 15px textbox at(x=55, y=40) */ - oled.TextBox((uint8_t *)text,5,75,20,15); //Increase textbox for more digits + oled.TextBox((uint8_t *)text,5,81,20,15); //Increase textbox for more digits /* Set text properties to white and right aligned for the dynamic text */ textProperties.fontColor = COLOR_GREEN; textProperties.alignParam = OLED_TEXT_ALIGN_CENTER; oled.SetTextProperties(&textProperties); + + /* Display Legends */ + strcpy((char *) text,"Pitch"); + oled.Label((uint8_t *)text,37,67); /* Format the value */ sprintf(text,"%i",y); /* Display time reading in 35px by 15px textbox at(x=55, y=40) */ - oled.TextBox((uint8_t *)text,37,75,20,15); //Increase textbox for more digits + oled.TextBox((uint8_t *)text,37,81,20,15); //Increase textbox for more digits /* Set text properties to white and right aligned for the dynamic text */ textProperties.fontColor = COLOR_RED; textProperties.alignParam = OLED_TEXT_ALIGN_RIGHT; oled.SetTextProperties(&textProperties); + /* Display Legends */ + strcpy((char *) text,"Yaw"); + oled.Label((uint8_t *)text,70,67); + /* Format the value */ sprintf(text,"%i",z); /* Display time reading in 35px by 15px textbox at(x=55, y=40) */ - oled.TextBox((uint8_t *)text,70,75,20,15); //Increase textbox for more digits + oled.TextBox((uint8_t *)text,70,81,20,15); //Increase textbox for more digits led1 = !led1; Thread::wait(250);