-36%




















五向導航按鍵模組 5D搖杆 單片機 獨立鍵盤開關 適用於 Arduino 模組
0 out of 5
NT$70 原始價格:NT$70。NT$45目前價格:NT$45。 (未稅)
- 描述
- 評價 (0)
描述
描述
五向導航按鍵模組 5D搖杆 單片機 獨立鍵盤開關 適用於 Arduino 模組
五向導航按鍵模組 支持上/下/左/右/中,帶有額外的設置和復位按鈕2V-9V寬工作電壓和7個IO端口引腳兼容大多數MCU開發板引腳說明:1. COM(通用end):VCC 或 GND 接單片機開發板2. UP(上方向鍵):接單片機 IO 腳3. DWN(下方向鍵):接單片機 IO 腳4. LFT(左方向)按鈕):連接到 MCU 的 IO 腳5. RHT(右方向按鈕):連接到 MCU 的 IO 腳6. MID(中間方向按鈕):連接到 MCU 的 IO 腳7. SET(設置按鈕):連接到 MCU 的 IO 引腳。
本搖桿模塊的PIN結構

將 5 個方向按鈕模塊與 Arduino 連接
第 1 步:電路
以下電路顯示瞭如何將 Arduino 連接到該模塊。相應地連接電線。

第 1 步:代碼
將以下代碼上傳到您的 Arduino。之後打開串行監視器。
Arduino
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
/* 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); } } |
在上面的代碼中,每個鍵都設置為 Arduino 引腳之一的輸入。通過按每個鍵,它將出現在串行監視器上。
輸出如下。

評價 (0)
相關商品
-
按鍵 / 輸入 / 人機介面模組
Grove Switch(P) 開關模組
0 out of 5NT$100原始價格:NT$100。NT$95目前價格:NT$95。 (未稅)加入購物車產品速覽 -
按鍵 / 輸入 / 人機介面模組
Grove – Mouse Encoder 機械式旋轉編碼器
0 out of 5NT$219原始價格:NT$219。NT$210目前價格:NT$210。 (未稅)加入購物車產品速覽 -
按鍵 / 輸入 / 人機介面模組
微動開關 4×4 矩陣 16 按鍵/鍵盤模組
0 out of 5NT$45原始價格:NT$45。NT$35目前價格:NT$35。 (未稅)加入購物車產品速覽 -
按鍵 / 輸入 / 人機介面模組
Grove Tilt Switch 傾斜開關
0 out of 5NT$110原始價格:NT$110。NT$90目前價格:NT$90。 (未稅)加入購物車產品速覽
商品評價
目前沒有評價。