cpuTemperature()
描述
讀取 86Duino CPU 的溫度。在 86Duino Coding 102 版本以後才可以使用這個函式。
語法
cpuTemperature(mode)
cpuTemperature()
參數
mode: DEGREE_C,或 DEGREE_F 代表讀取的溫度單位為攝氏 (°C) 或華氏 (°F)。預設是以攝氏為單位。
回傳
CPU 溫度值 (double)
範例
double val1 = 0.0;
double val2 = 0.0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
val1 = cpuTemperature(); // 溫度單位預設是攝氏
val2 = cpuTemperature(DEGREE_F); // 改用華氏為單位
Serial.print(val1);
Serial.print(" ");
Serial.println(val2);
delay(100);
}
本頁由熱血青年 LBU 譯自英文版。
The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.
