標題:
analogRead()
[打印本頁]
作者:
tonyh
時間:
2019-2-10 10:52
標題:
analogRead()
[attach]5895[/attach]
[attach]5896[/attach]
int sensorPin=A0;
int sensorValue;
int buzzerPin=13;
//int temp;
void setup()
{
Serial.begin(9600);
pinMode(buzzerPin,OUTPUT);
}
void loop()
{
sensorValue=analogRead(sensorPin);
Serial.println(sensorValue);
//temp=166*((float)(sensorValue-19)/339)-41;
//Serial.println(temp);
if(sensorValue>300)
digitalWrite(buzzerPin,HIGH);
else
digitalWrite(buzzerPin,LOW);
delay(100);
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2