硬件平台:STM32F429I-DISCORVERY 软件平台:KEIL MDK5.10 1.关于pitch yaw roll 的区别: http://blog.163.com/vipwdp@126/blog/static/150224366201281935518196/ 2.Z轴正方向为飞机前进方向 pitch():俯仰,将物体绕X轴旋转(localRotationX) yaw():航向,将物体绕Y轴旋转(localRotationY) roll():横滚,将物体绕Z轴旋转(localRotationZ) This example is used as a template project that can be used as reference to build any new firmware application for STM32F429xx devices using the STM32F4xx Standard Peripherals Library. @par Hardware and Software environment - This example runs on STMF429xx Devices. - This example has been tested with STMicroelectronics STM32F429I-DISCO board and can be easily tailored to any other supported device and development board. 背景知识:L3GD20是低功耗三轴角速率传感器。它包括一个传感元件和一个集成电路接口,能够提供外部的角速率测量通过数字接口(I2C / SPI)。它是由意法半导体使用专用微加工工艺硅片生产惯性传感器和驱动器。 L3GD20 数字陀螺仪有用户可自行设定全量程(±250 /±500 /±2000 dps)和可选的带宽。低量程用于高精度测量慢速运动,高量程则用于测量超快速的手势和运动。新产品为用户提供16位数据输出,以及附加的嵌入式数字功能,如可配置的低通高通滤波器。内置智能电源管理所需的先入先出(FIFO)存储块。工作电压范围为2.4V至3.6V. Features: Three selectable full scales (±250/500/2000 dps) 20+ kHz resonant frequency over the audio bandwidth I2C/SPI digital output interface 16-bit rate data output 8-bit temperature data output Wide supply voltage: 2.4 to 3.6 V Low-voltage compatible IOs (1.8 V) Embedded FIFO Embedded power-down and sleep modes Embedded temperature sensor High shock survivability #include "stm32f429i_discovery.h" #include "stm32f429i_discovery_lcd.h" #include "l3gd20.h" #include "key.h" #include "SysTick.h" #include "usart.h" float Buffer[3]; //输出数据保存数组 float Gyro[3]; //校准值 uint8_t Xval, Yval; int main(void) { SysTick_Init(); STM_EVAL_LED_Config(); STM_EVAL_PBInit(BUTTON_MODE_EXTI); USART1_GPIO_Config(); printf("\n\rHello, Stm32f429-discovery Board ! \n\r"); printf("\n\r代码烧录日期: "__DATE__" @ "__TIME__"\n\r"); printf("\n\r固件库版本: V %x \n\r",__STM32F4XX_STDPERIPH_VERSION); printf("\n\rCPUID IS: 0X%X %X %X.\n\r", *(__IO u32*)(0x1FFF7A10),*(__IO u32*)(0x1FFF7A14),*(__IO u32*)(0x1FFF7A18)); printf("\n\rMCU内部Flash大小:%d K字节.\n\r", *(uint16_t*)(0x1FFF7A22)); printf("\n\r系统内核时钟频率SystemCoreClock:%dHz.\n\r",SystemCoreClock); /* Initialize the LCD */ LCD_Init(); LCD_LayerInit(); LTDC_Cmd(ENABLE); LCD_SetLayer(LCD_FOREGROUND_LAYER); LCD_Clear(LCD_COLOR_BLUE); Demo_GyroConfig(); /* Gyroscope configuration */ Gyro_SimpleCalibration(Gyro); /* Gyroscope 校准*/ printf("\n\r陀螺仪L3GD20 ID :0x%x \n\r",L3GD20_ReadID()); while (1) { /* Read Gyro Angular data ,to save in Buffer[6]*/ Demo_GyroReadAngRate(Buffer); Buffer[0] = (int8_t)Buffer[0] - (int8_t)Gyro[0]; //x Buffer[1] = (int8_t)Buffer[1] - (int8_t)Gyro[1]; //Y Buffer[2] = (int8_t)Buffer[2] - (int8_t)Gyro[2]; //Z /* Update autoreload and capture compare registers value*/ Xval = ABS((int8_t)(Buffer[0])); Yval = ABS((int8_t)(Buffer[1])); if ( Xval>Yval) { if ((int16_t)Buffer[0] > 40) { /* Clear the LCD */ LCD_Clear(LCD_COLOR_WHITE); LCD_SetTextColor(LCD_COLOR_MAGENTA); LCD_DrawFullRect(100, 40, 40, 120); LCD_FillTriangle(50, 190, 120, 160, 160, 310); Delay(50); } if ((int16_t)Buffer[0] < -40) { /* Clear the LCD */ LCD_Clear(LCD_COLOR_WHITE); LCD_SetTextColor(LCD_COLOR_RED); LCD_DrawFullRect(100, 160, 40, 120); LCD_FillTriangle(50, 190, 120, 160, 160, 10); Delay(50); } } else { if ((int16_t)Buffer[1] < -40) { /* Clear the LCD */ LCD_Clear(LCD_COLOR_WHITE); LCD_SetTextColor(LCD_COLOR_GREEN); LCD_DrawFullRect(120, 140, 100, 40); LCD_FillTriangle(120, 120, 5, 60, 260, 160); Delay(50); } if ((int16_t)Buffer[1] > 40) { /* Clear the LCD */ LCD_Clear(LCD_COLOR_WHITE); LCD_SetTextColor(LCD_COLOR_BLUE); LCD_DrawFullRect(20, 140, 100, 40); LCD_FillTriangle(120, 120, 235, 60, 260, 160); Delay(50); } } } } |
【STM32F429开发日志】汉字显示(取模方式)
【STM32F429开发日志】5.uCOS-ii V2.91 移植OK
图形化玩转Nucleo-STM32F413手机APP远程控制应用开发
【stm32F429开发日志】使用STM32CubeMX配置STM32F429_USB_HID
【STM32F429开发日志】(三)使用STM32Cube开发环境
【STM32F429开发日志】——网络收集的例程分享(包括所有STM32F429Discovery板上外设驱动)
分享个用STM32F429做的网络摄像头
STM32F429UCOS 源代码
【STM32F429开发日志】+hello led(闪烁led灯)
STM32F429DSICOVERY移植到STemWIN(图片+源码)
RE:【STM32F429开发日志】3.板载mems测试,三轴角加速度Printf输出
RE:【STM32F429开发日志】3.板载mems测试,三轴角加速度Printf输出
回复:【STM32F429开发日志】3.板载mems测试,三轴角加速度Printf输出
RE:【STM32F429开发日志】3.板载mems测试,三轴角加速度Printf输出
回复:【STM32F429开发日志】3.板载mems测试,三轴角加速度Printf输出
RE:【STM32F429开发日志】3.板载mems测试,三轴角加速度Printf输出
回复:【STM32F429开发日志】3.板载mems测试,三轴角加速度Printf输出
回复:【STM32F429开发日志】3.板载mems测试,三轴角加速度Printf输出
回复:【STM32F429开发日志】3.板载mems测试,三轴角加速度Printf输出
回复:【STM32F429开发日志】3.板载mems测试,三轴角加速度Printf输出
很牛逼 准备用来开发云台
回复:【STM32F429开发日志】3.板载mems测试,三轴角加速度Printf输出
回复:【STM32F429开发日志】3.板载mems测试,三轴角加速度Printf输出
RE:【STM32F429开发日志】3.板载mems测试,三轴角加速度Printf输出
RE:【STM32F429开发日志】3.板载mems测试,三轴角加速度Printf输出