资源简介
树莓派下使用I2C读取mpu9250,获得欧拉角YAW,PITCH,ROLL,并输出,稳定
代码片段和文件信息
#include
#include
#include
#include
#include
#include “MotionSensor.h“
#define delay_ms(a) usleep(a*1000)
/*SQLITE3 DB*/
static sqlite3 *db = NULL;
static char *errmsg = NULL;
int main() {
char sql[512] ; //插入数据库语句
int ret;
int insert;
ret = sqlite3_open(“mpu9250.db“ &db);
if(ret)
{
printf(“can not open database.\n“);
}
else
{
printf(“open database succsee.\n“);
}
int i = 0;
ms_open();
while(i < 5000){
ms_update();
sprintf(sql“insert into mpu9250 values (%d%2.1f%2.1f %2.1f %2.1f %2.1f %2.1f);“ i ypr[YAW] ypr[PITCH] ypr[ROLL]compass[0]compass[1]compass[2]);
insert = sqlite3_exec(db sql 0 0 &errmsg);//插入
printf(“index= %d\tyaw = %2.1f\tpitch = %2.1f\troll = %2.1f\ttemperature = %2.1f\tcompass = %2.1f %2.1f %2.1f\n“ iypr[YAW] ypr[PITCH]ypr[ROLL]tempcompass[0]compass[1]compass[2]);
delay_ms(5);
i++;
}
sqlite3_close(db);
return 0;
}
相关资源
- Hi3536 Linux开发环境用户指南
- 智能家居系统项目 嵌入式
- 制作mipsel-linux交叉编译工具
- linux系统下的内存测试工具
- GNU/Linux系统开发者需要从桌面突破
- the_definitive_guide_to_linux_network_programm
- linux-shell脚本命令:grep命令简介
- Learning Linux Binary Analysis
- 蓝牙源代码应用于LINUX
- Micrium.RTOS.1.0.0.pack
- uboot到linux logo显示不间断 补丁
- ISE_14.7_license.lic
- stm32f103c8t6 4 oled.rar
- mpu6050+hmc5883L.rar
- UNIX/LINUX编程实践教程的源码
- 嵌入式图形界面MiniGUI的示例程序9例
- Linux任务管理器
- linux应用层的华容道游戏源代码
- ubuntu9.10 可加载内核模块和字符设备驱
- MP3文件ID3v2ID3v2APEv2标签读取
- ARM嵌入式项目实战
- 操作系统实验——虚存管理实验
- linux下的发包工具sendip
- 尚观培训linux许巍关于c 的笔记和讲义
- 尚观培训linux董亮老师关于数据结构的
- linux 线程池源码 c 版
- linux C 电梯程序练习
- linux下用多进程同步方法解决生产者
- uCOS编译环境建立 BC45 TASM
- Linux 操作系统实验(全)
评论
共有 条评论