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