我目前正在寫這個簡單的代碼來檢查溫度傳感器DS18B20溫度傳感器和Arduino的
#include <One Wire . h>
int DS18S20_Pin = 2; //DS18S20 Signal pin on digital 2
//Temperature chip i/o
OneWire ds(DS18S20_Pin); // on digital pin 2
void setup(void) {
Serial.begin(9600);
}
void loop(void)
{
float temperature = getTemp();
Serial.println(temperature);
delay(100); //just here to slow down the output so it is easier to read
}
我m到處「sketch_feb27a:14:錯誤:‘getTemp’在此範圍內未聲明」
能有人告訴我爲什麼?
是getTemp()的一個庫函數?你有收錄嗎? –