ขาย Funduino Soil Moisture Sensor เซ็นเซอร์วัดความชื้นในดิน (รุ่น Arduino) ราคาที่ดีที่สุด
4.9
18
การให้คะแนน
17
ขายแล้ว
฿35
เรือจาก | จังหวัดนครราชสีมา |
---|
รายละเอียดสินค้า
Soil moisture sensor เป้นเซนเซอร์ที่ใช้สำหรับวัดค่าความชื้นในดิน ใช้ไฟเลี้ยง 5V และให้สัญญาณ Output แบบ Analog (0-1023)
การต่อวงจร
Arduino Soil moisture sensor 5V + GND - pin A0 S
โค้ดตัวอย่างการใช้งาน
int sensorPin = A0; // select the input pin for sensor
int sensorValue = 0; // variable to store the value coming from the sensor
void setup()
{
Serial.begin(9600);
}
void loop()
{
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
delay(1000);
Serial.print("sensor = " );
Serial.println(sensorValue);
}
ตัวอย่างการต่อวงจรตัวอย่างโค้ต
int sensorPin = A0; // select the input pin for the Soil moisture sensor int sensorValue = 0; // variable to store the value coming from the sensor void setup() { // declare the ledPin as an OUTPUT: Serial.begin(9600); } void loop() { // read the value from the sensor: sensorValue = analogRead(sensorPin); delay(500); Serial.print("sensor = " ); Serial.println(sensorValue); if(sensorValue 300 sensorValue