本文整理汇总了C++中LSM303::readFIFO方法的典型用法代码示例。如果您正苦于以下问题:C++ LSM303::readFIFO方法的具体用法?C++ LSM303::readFIFO怎么用?C++ LSM303::readFIFO使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LSM303
的用法示例。
在下文中一共展示了LSM303::readFIFO方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
pc.printf("Starting \r\n");
setup(); //initializes all hardware sensors
t.start();
while(button){
timeLastPoll = t.read_ms();
altitude = ps.pressureToAltitudeMeters(ps.readPressureMillibars());
acc.readFIFO();
gyr.readFIFO();
// pc.printf("%d Att: %2.2f \tGyr: %2.2f %2.2f %2.2f \tAcc: %2.2f %2.2f %2.2f \tT: %d\r\n",
// iter,
// altitude,
// gyr.g.x,gyr.g.y,gyr.g.z,
// acc.a.x,acc.a.y,acc.a.z,
// t.read_ms()-timeLastPoll);
if (iter != 0){
calcMotionData(a);
}
else{
calcMotionData(1.0);
}
r_altitude = roundData(altitude);
r_incline = roundData(incline);
r_dist = roundData(tot_dist/50.0);
r_speed = roundData(speed);
// pc.printf("%d \t%d \t%d \t%d\r\n",r_altitude,r_incline,r_dist,r_speed);
fprintf(fp, "%d, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %d, %d, %d \r\n",
(t.read_ms() - timeLastPoll),
altitude,
gyr.g.x,gyr.g.y,gyr.g.z,
acc.a.x,acc.a.y,acc.a.z,
incline,tot_dist,speed,
r_incline,
r_dist,
r_speed);
static unsigned long lastSendTime = millis();
if (lastSendTime + 250 < millis()) {
BTModu.sendData(String("x")+packageData2String(r_altitude)+
packageData2String(r_incline)+
packageData2String(r_dist)+
packageData2String(r_speed) );
lastSendTime += 250;
}
saveLastData();
while( (t.read_ms() - timeLastPoll) < MBED_POLLING_PERIOD_MS){
gled = 0;
}
// pc.printf("LT: %d\r\n",t.read_ms()-timeLastPoll);
gled = 1; iter++;
}
fclose(fp);
pc.printf("File successfully written! \r\n");
printf("End of Program. \r\n");
}