summaryrefslogtreecommitdiff
path: root/debug/data_logging_teensy_temp
diff options
context:
space:
mode:
authorAbel Tim <abel@main.home>2024-07-06 11:51:53 +0200
committerAbel Tim <abel@main.home>2024-07-06 11:51:53 +0200
commit1e9c0466ff5af12735f3c7330e961867030c0110 (patch)
tree8a11af38b9dcdc7b1d2da4d8f09644bd4539c45d /debug/data_logging_teensy_temp
parent989874b7bf0f480433d57418ee8cee5d383f67bc (diff)
downloadrobotica-1e9c0466ff5af12735f3c7330e961867030c0110.tar.gz
robotica-1e9c0466ff5af12735f3c7330e961867030c0110.zip
Motor Calibration capabilities
Diffstat (limited to 'debug/data_logging_teensy_temp')
-rw-r--r--debug/data_logging_teensy_temp/InternalTemperature-master.zipbin0 -> 246290 bytes
-rw-r--r--debug/data_logging_teensy_temp/data_logging_teensy_temp.ino63
2 files changed, 63 insertions, 0 deletions
diff --git a/debug/data_logging_teensy_temp/InternalTemperature-master.zip b/debug/data_logging_teensy_temp/InternalTemperature-master.zip
new file mode 100644
index 0000000..64b7dc4
--- /dev/null
+++ b/debug/data_logging_teensy_temp/InternalTemperature-master.zip
Binary files differ
diff --git a/debug/data_logging_teensy_temp/data_logging_teensy_temp.ino b/debug/data_logging_teensy_temp/data_logging_teensy_temp.ino
new file mode 100644
index 0000000..fcd6c64
--- /dev/null
+++ b/debug/data_logging_teensy_temp/data_logging_teensy_temp.ino
@@ -0,0 +1,63 @@
+#include <InternalTemperature.h>
+#include <SD.h>
+#include <SPI.h>
+
+File ;
+File avrage;
+const int chipSelect = BUILTIN_SDCARD;
+
+/
+
+void setup()
+{
+ Serial.begin(9600);
+
+ //open current loop motor values file
+ current = SD.open("motor_values.csv", FILE_WRITE);
+
+ while(true){
+ if (current) {
+ if (SD.exists((String("motor_values") + x + ".csv").c_str())){
+ Serial.println(((String)"motor_values"+x+".csv already exists"));
+ x++;
+ } else {
+ Serial.println((String)"motor_values"+x+".csv"" doesn't exist.");
+ Serial.println((String)"creating motor_values"+x+".csv");
+ current = SD.open(((String("motor_values") + x + ".csv").c_str()), FILE_WRITE);
+ break;
+ }
+ }
+ delay(1);
+ }
+ Serial.println("!!!setup complete!!!");
+}
+
+
+void loop()
+{
+ String currentvals = "";
+ String avrvals = "";
+
+ currentvals += InternalTemperature.readTemperatureC();
+ d_println("°C");
+ debugdataString += "°C";
+
+ //log sensor data to sensor log
+ sensordataString += InternalTemperature.readTemperatureC();
+ sensordataString += ", ";
+
+ //open sensor log file
+ File csvfile = SD.open((String("motor_values") + x + ".csv").c_str()), FILE_WRITE);
+ if (csvfile) {
+ csvfile.println(sensordataString);
+ csvfile.close();
+ }
+
+ //open debug file
+ File dataFile = SD.open("avrage_motor_values.txt", FILE_WRITE);
+ if (dataFile) {
+ dataFile.println((String)"debug data:"+debugdataString+"sensor data"+sensordataString);
+ dataFile.close();
+ }
+ delay(1000);
+}