编程营地arduino玩转Arduino

【Arduino基础教程】Moisture Sensor土壤湿度

2016-06-28  本文已影响1624人  繁著
Moisture Sensor土壤湿度传感器

Moisture Sensor土壤湿度传感器可读取在其周围的土壤存在的水分的量。因此,它可以用于监视你的花园土壤湿度并提醒你适时浇花。

模块特征

0 ~300 : 干燥
300~700 : 湿润
700~950 : 水分充足

准备材料

模块接线

接线示意图
Moisture Sensor Arduino
S -> A0
+ -> 5V
- -> GND

示例程序

/*
  # Example code for the moisture sensor
  # Editor     : Lauren
  # Date       : 13.01.2012
  # Version    : 1.0
  # Connect the sensor to the A0(Analog 0) pin on the Arduino board
   
  # the sensor value description
  # 0  ~300     dry soil
  # 300~700     humid soil
  # 700~950     in water
*/
 
void setup(){
  Serial.begin(9600);
}
 
void loop(){ 
  Serial.print("Moisture Sensor Value:");
  Serial.println(analogRead(A0));  
  delay(100);
}

上传程序后,在工具->串口监视器中就可以看到土壤的实时湿度值。

参考文献

http://www.dfrobot.com/wiki/index.php?title=Moisture_Sensor_(SKU:SEN0114)

上一篇 下一篇

猜你喜欢

热点阅读