Strana 70 z 73
Poznámky redaktora
startsWith("/datalog_") n.name(); "/datalog_123.Az (m/s2).Voltage (V).endTransmission();
delay(1000);
Serial.Energy (Wh).csv"
if (n.beginTransmission(0x68);
Wire.Temp_Motor.15);
return (1.println(CSV_HEADER); f.Accel Y.close();
f root.close();
Serial.Accel Z.0 st) 273.0);
float resistance (SERIES_RESISTOR (3.open(curFile, FILE_WRITE);
if (f) f.csv") n.70
// ---------- CSV hlavička ----------
const char *CSV_HEADER =
"Time (ms).println("Nový log: String(curFile));
} else {
Serial."
"Gyro X.println("BMI160 auto-kalibrace dokončena");
}
// ---------- utilities ----------
void findLastIndex() {
fileIndex 0;
File root SD.replace('.close();
}
void createNewLogFile() {
do fileIndex++; sprintf(curFile, "/datalog_%03u.openNextFile();
while (f) {
String f.3 voltage)) voltage;
float log(resistance NOMINAL_RESISTANCE) /
BETA_COEFFICIENT;
st 1.Temp_Ambient";
// ---------- pomocné funkce ----------
float getTemperature(int pin) {
float voltage analogRead(pin) (3.Roll (deg).0 (NOMINAL_TEMPERATURE 273.endsWith(".write(0x7E); Wire.', ','); return s;
}
void bmiAutoCalibrate() {
Wire.Power (W).write(0x37); Wire."
"Ax (m/s2).Current (A).exists(curFile));
File SD."
"Temp_Battery.3 4095.println("Chyba tvorby logu!");
}
}
.Gyro Y.Ay (m/s2).length()
== 15) {
uint16_t idx n.Accel X.csv", fileIndex); }
while (SD.open("/");
File root.openNextFile();
}
root.toInt();
if (idx fileIndex) fileIndex idx;
}
f.15;
}
String floatToStringComma(float value, uint8_t decimals) {
char buf[24]; dtostrf(value, decimals, buf);
String s(buf); s.Pitch (deg).substring(9, 12).Gyro Z