หากต้องการใบเสนอราคา / ใบแจ้งหนี้ ติดต่อได้ทาง LINE Official: @mikroelec |
![]() |
รหัสสินค้า | SKU-02583 |
หมวดหมู่ | โมดูล JoyStick |
ราคา | 25.00 บาท |
สถานะสินค้า | พร้อมส่ง |
ลงสินค้า | 6 ก.พ. 2567 |
อัพเดทล่าสุด | 27 มิ.ย. 2568 |
จำนวน | ชิ้น |
This Module has 8 pins:
You can see the pinout of this module in the image below.
โคดตัวอย่าง
/*
Made on Dec 12, 2020
By MehranMaleki @ Electropeak
Home
*/
const int buttonPin_RST = 2; // the number of the reset button pin
const int buttonPin_SET = 3; // the number of the set button pin
const int buttonPin_MID = 4; // the number of the middle button pin
const int buttonPin_RHT = 5; // the number of the right button pin
const int buttonPin_LFT = 6; // the number of the left button pin
const int buttonPin_DWN = 7; // the number of the down button pin
const int buttonPin_UP = 8; // the number of the up button pin
void setup() {
Serial.begin(9600);
pinMode(buttonPin_RST, INPUT_PULLUP);
pinMode(buttonPin_SET, INPUT_PULLUP);
pinMode(buttonPin_MID, INPUT_PULLUP);
pinMode(buttonPin_RHT, INPUT_PULLUP);
pinMode(buttonPin_LFT, INPUT_PULLUP);
pinMode(buttonPin_DWN, INPUT_PULLUP);
pinMode(buttonPin_UP, INPUT_PULLUP);
}
void loop() {
if(digitalRead(buttonPin_RST) == LOW) {
delay(250);
Serial.println("Reset Pin Is Pressed.");
while(digitalRead(buttonPin_RST) == LOW);
}
if(digitalRead(buttonPin_SET) == LOW) {
delay(250);
Serial.println("Set Pin Is Pressed.");
while(digitalRead(buttonPin_SET) == LOW);
}
if(digitalRead(buttonPin_MID) == LOW) {
delay(250);
Serial.println("Middle Pin Is Pressed.");
while(digitalRead(buttonPin_MID) == LOW);
}
if(digitalRead(buttonPin_RHT) == LOW) {
delay(250);
Serial.println("Right Pin Is Pressed.");
while(digitalRead(buttonPin_RHT) == LOW);
}
if(digitalRead(buttonPin_LFT) == LOW) {
delay(250);
Serial.println("Left Pin Is Pressed.");
while(digitalRead(buttonPin_LFT) == LOW);
}
if(digitalRead(buttonPin_DWN) == LOW) {
delay(250);
Serial.println("Down Pin Is Pressed.");
while(digitalRead(buttonPin_DWN) == LOW);
}
if(digitalRead(buttonPin_UP) == LOW) {
delay(250);
Serial.println("Up Pin Is Pressed.");
while(digitalRead(buttonPin_UP) == LOW);
}
}
หน้าที่เข้าชม | 563,672 ครั้ง |
ผู้ชมทั้งหมด | 321,315 ครั้ง |
ร้านค้าอัพเดท | 19 ต.ค. 2568 |