[mw_shl_code=c,true] while(ADXL345_Init()) //3D加速度传感器初始化
{
printf("ADXL345 Error
");
delay_ms(200);
delay_ms(200);
LED_GREEN_flash = 0;
}
printf("ADXL345 OK
");
[/mw_shl_code]
[mw_shl_code=c,true] ADXL345_Read_Average(&x,&y,&z,10);
// ADXL345_RD_XYZ(&Acceleration_x,&Acceleration_y,&Acceleration_z);
printf("x = %d
",x);
printf("y = %d
",y);
printf("z = %d
",z);
delay_ms(50);
[/mw_shl_code]
50ms读取输出一次 代码是战舰版复制过来的
x = 17y = 0z = 0
x = 17y = 0z = 0
x = 17y = 0z = 0
x = 15y = 0z = 0
x = 17y = 0z = 0
x = 17y = 0z = 0
x = 18y = 0z = 0
x = 17y = 0z = 0
x = 16y = 0z = 0
x = 17y = 0z = 0
x = 16y = 0z = 0
x = 17y = 0z = 0
打印出来就是这个样子 y和z一直是0 变化板子时 只有x变化
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>