Created
November 14, 2023 03:45
-
-
Save penpencool/c259b99f49cbb95bb8edc41a483d17ba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // กำหนดขาที่เชื่อมต่อกับ E3F-DS300C1 | |
| const int sensorPin = 2; // แก้ไขตามขาที่คุณใช้ | |
| void setup() { | |
| // กำหนดขาเป็นขานำเข้า | |
| pinMode(sensorPin, INPUT); | |
| // เปิด Serial Monitor | |
| Serial.begin(9600); | |
| } | |
| void loop() { | |
| // อ่านค่าจากเซ็นเซอร์ | |
| int sensorValue = digitalRead(sensorPin); | |
| // ส่งค่าไปยัง Serial Monitor | |
| Serial.println(sensorValue); | |
| // รอสักครู่ | |
| delay(1000); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment