CODE 6.7 | 토양 습도 센서 아날로그 값 읽기
| 01 | int soilPin = A0; // 토양 습도 센서를 연결한 아날로그 핀 |
| 02 | |
| 03 | void setup() { |
| 04 | Serial.begin(9600); // 시리얼 모니터 통신 시작 |
| 05 | } |
| 06 | |
| 07 | void loop() { |
| 08 | int moistureValue = analogRead(soilPin); // 토양 습도 센서 값 읽기 |
| 09 | |
| 10 | Serial.print("Soil Moisture Raw Value: "); |
| 11 | Serial.println(moistureValue); // 읽은 값을 시리얼 모니터에 출력 |
| 12 | |
| 13 | delay(1000); // 1초 대기 후 다시 측정 |
| 14 | } |
댓글 없음:
댓글 쓰기