Arduino應用
老化箱校正
<C>
- include <SPI.h>
- include <SD.h>
- include "Max6675.h"
File myFile; // Max6675 module: SO on pin #8, SS on pin #9, CSK on pin #10 of Arduino UNO // Other pins are capable to run this library, as long as digitalRead works on SO, // and digitalWrite works on SS and CSK Max6675 ts(5, 6, 7);
void setup() {
Serial.begin(9600);
while (!Serial) { // 等待串列埠連線
}
Serial.print("Initializing SD card...");
if (!SD.begin(4)) {
Serial.println("Fail!");
return;
}
Serial.println("Success!");
ts.setOffset(0);
}
void loop() {
float t= ts.getCelsius();
String strT= String("")+t+","+millis();
Serial.println(strT);
myFile = SD.open("card.txt", FILE_WRITE);
myFile.println(strT);
myFile.close(); // 關閉檔案
Serial.println("Completed!");
delay(10000);
} </c>