Created
April 12, 2024 10:16
-
-
Save maxpromer/984d5715afa9950b9380503432f4675c to your computer and use it in GitHub Desktop.
This file contains 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
#define SIG_PIN 4 // กำหนดขาที่ต้อ SIG | |
#define EN_PIN 16 // กำหนดขาที่ต่อ EN | |
void setup() { | |
pinMode(SIG_PIN, INPUT); // กำหนดขา SIG เป็นอินพุต | |
pinMode(EN_PIN, OUTPUT); // กำหนดขา EN เป็นอินพุต | |
digitalWrite(EN_PIN, HIGH); // สั่งให้ขา EN เป็นลอจิก 1 (HIGH) เพื่อให้รับเหรียญ | |
Serial.begin(115200); // ใช้ Serial ที่ความเร็ว 115200 | |
} | |
void loop() { | |
if (digitalRead(SIG_PIN) == LOW) { // ถ้ามีสัญญาณเข้ามาที่ขา SIG | |
Serial.println("Got coin !!!"); // แสดงข้อความใน Serial Monitor | |
delay(200); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment