「Arduino應用」:修訂間差異
跳至導覽
跳至搜尋
Stanleyliu(留言 | 貢獻) 已建立頁面,內容為 "==老化箱校正== <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…" |
Stanleyliu(留言 | 貢獻) |
||
| (未顯示同一使用者於中間所作的 1 次修訂) | |||
| 第38行: | 第38行: | ||
Serial.println("Completed!"); | Serial.println("Completed!"); | ||
delay(10000); | delay(10000); | ||
} | |||
</c> | |||
*增加看板 | |||
<c> | |||
#include <SPI.h> | |||
#include <RGBmatrixPanel.h> | |||
#include "Max6675.h" | |||
#define CLK 8 // USE THIS ON ARDUINO UNO, ADAFRUIT METRO M0, etc. | |||
//#define CLK A4 // USE THIS ON METRO M4 (not M0) | |||
//#define CLK 11 // USE THIS ON ARDUINO MEGA | |||
#define OE 9 | |||
#define LAT 10 | |||
#define A A0 | |||
#define B A1 | |||
#define C A2 | |||
RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false); | |||
Max6675 ts(A3,A4,A5); | |||
void setup() | |||
{ | |||
Serial.begin(9600); | |||
matrix.begin(); | |||
ts.setOffset(0); | |||
matrix.fillScreen(matrix.Color333(0, 0, 0)); | |||
matrix.setCursor(1, 0); // start at top left, with one pixel of spacing | |||
matrix.setTextSize(1); // size 1 == 8 pixels high | |||
matrix.setTextColor(matrix.Color333(7,0,0));// print each letter with a rainbow color | |||
} | |||
void loop() | |||
{ | |||
float t= ts.getCelsius(); | |||
String strT= String("")+t+","+millis(); | |||
Serial.println(strT); | |||
matrix.fillScreen(matrix.Color333(0, 0, 0)); | |||
matrix.setCursor(0, 0); | |||
matrix.setTextColor(matrix.Color333(7,0,0)); | |||
matrix.print(t); | |||
matrix.setCursor(0, 8); | |||
matrix.setTextColor(matrix.Color333(0,7,0)); | |||
matrix.print(millis()/1000); | |||
// 關閉檔案 | |||
Serial.println("Completed!"); | |||
delay(3000); | |||
} | } | ||
</c> | </c> | ||
於 2019年5月22日 (三) 13:41 的最新修訂
老化箱校正
<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>
- 增加看板
<c>
- include <SPI.h>
- include <RGBmatrixPanel.h>
- include "Max6675.h"
- define CLK 8 // USE THIS ON ARDUINO UNO, ADAFRUIT METRO M0, etc.
//#define CLK A4 // USE THIS ON METRO M4 (not M0) //#define CLK 11 // USE THIS ON ARDUINO MEGA
- define OE 9
- define LAT 10
- define A A0
- define B A1
- define C A2
RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false); Max6675 ts(A3,A4,A5);
void setup() {
Serial.begin(9600); matrix.begin(); ts.setOffset(0);
matrix.fillScreen(matrix.Color333(0, 0, 0)); matrix.setCursor(1, 0); // start at top left, with one pixel of spacing matrix.setTextSize(1); // size 1 == 8 pixels high matrix.setTextColor(matrix.Color333(7,0,0));// print each letter with a rainbow color
}
void loop() {
float t= ts.getCelsius();
String strT= String("")+t+","+millis();
Serial.println(strT);
matrix.fillScreen(matrix.Color333(0, 0, 0));
matrix.setCursor(0, 0);
matrix.setTextColor(matrix.Color333(7,0,0));
matrix.print(t);
matrix.setCursor(0, 8);
matrix.setTextColor(matrix.Color333(0,7,0));
matrix.print(millis()/1000);
// 關閉檔案
Serial.println("Completed!");
delay(3000);
} </c>