CODE 5.15 | 가변 저항 아날로그 값 읽기
| 01 | int potPin = A0; // 가변 저항을 연결한 아날로그 핀 |
| 02 | |
| 03 | void setup() { |
| 04 | Serial.begin(9600); // 시리얼 모니터 통신 시작 |
| 05 | } |
| 06 | |
| 07 | void loop() { |
| 08 | int sensorValue = analogRead(potPin); // 가변 저항 값 읽기 |
| 09 | |
| 10 | Serial.print("Value: "); |
| 11 | Serial.println(sensorValue); // 읽은 값을 시리얼 모니터에 출력 |
| 12 | |
| 13 | delay(100); // 0.1초 대기 후 다시 측정 |
| 14 | } |
댓글 없음:
댓글 쓰기