簡體   English   中英

Arduino + sim800l + dht11

[英]Arduino + sim800l + dht11

我想只打一次電話。 但它一遍又一遍地呼喚。 代碼是 If(t>20){ Sim800l.println(ATD +電話號碼)} 我怎樣才能讓它只給我一次電話? 如果溫度超過 20°C,我只需要通知我。 使用 dht11、arduino uno 和 sim800l。

你可以使用這樣的標志。 每次溫度低於/等於 20 時,標志hasChanged將設置為true 並且當溫度上升到 20 度以上時,將打印一次消息,並且標志將切換到關閉狀態,直到下次溫度下降。

// you'll have to adjust the syntax to meet your language needs

bool hasChanged = true;
if (t>20 && hasChanged) {
   // this block happens once everytime the temperature surpasses 20
   Sim800l.println(ATD +phone number);
   hasChanged = false;
} else {
   hasChanged = true;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM