欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索

【Arduino】108種傳感器模塊系列實驗(124)---PS2接口模塊

查看數: 3771 | 評論數: 16 | 收藏 0
關燈 | 提示:支持鍵盤翻頁<-左 右->
    組圖打開中,請稍候......
發布時間: 2019-9-24 19:42

正文摘要:

37款傳感器與模塊的提法,在網絡上廣泛流傳,其實Arduino能夠兼容的傳感器模塊肯定是不止37種的。鑒于本人手頭積累了一些傳感器和模塊,依照實踐出真知(一定要動手做)的理念,以學習和交流為目的,這里準備逐一動 ...

回復

ID:513258 發表于 2019-9-25 10:46
  1. /*
  2. 【Arduino】108種傳感器模塊系列實驗(資料+代碼+圖形+仿真)
  3. 實驗一百二十四: PS2鼠標 鍵盤插座接口 PS2模塊
  4. 1、安裝< PS2Keyboard.h>庫
  5. (https://www.pjrc.com/teensy/arduino_libraries/PS2Keyboard.zip)
  6. 2、項目:在 Arduino 上使用 PS/2 鍵盤進行輸入測試(識別一些特殊按鍵)
  7. 3、PS/2 接口與 Arduino 接腳
  8. 5V :      - Arduino 5V out
  9. Ground : - Arduino GND
  10. Clock :    - Arduino Pin 3
  11. Data :     - Arduino Pin 8
  12. */
  13.    
  14. #include <PS2Keyboard.h>

  15. const int DataPin = 8;
  16. const int IRQpin =  3;

  17. PS2Keyboard keyboard;

  18. void setup() {
  19.   delay(1000);
  20.   keyboard.begin(DataPin, IRQpin);
  21.   Serial.begin(9600);
  22.   Serial.println("Keyboard Test:");
  23. }

  24. void loop() {
  25.   if (keyboard.available()) {
  26.    
  27.     // read the next key
  28.     char c = keyboard.read();
  29.    
  30.     // check for some of the special keys
  31.     if (c == PS2_ENTER) {
  32.       Serial.println();
  33.     } else if (c == PS2_TAB) {
  34.       Serial.print("[Tab]");
  35.     } else if (c == PS2_ESC) {
  36.       Serial.print("[ESC]");
  37.     } else if (c == PS2_PAGEDOWN) {
  38.       Serial.print("[PgDn]");
  39.     } else if (c == PS2_PAGEUP) {
  40.       Serial.print("[PgUp]");
  41.     } else if (c == PS2_LEFTARROW) {
  42.       Serial.print("[Left]");
  43.     } else if (c == PS2_RIGHTARROW) {
  44.       Serial.print("[Right]");
  45.     } else if (c == PS2_UPARROW) {
  46.       Serial.print("[Up]");
  47.     } else if (c == PS2_DOWNARROW) {
  48.       Serial.print("[Down]");
  49.     } else if (c == PS2_DELETE) {
  50.       Serial.print("[Del]");
  51.     } else {
  52.       
  53.       // otherwise, just print all normal characters
  54.       Serial.print(c);
  55.     }
  56.   }
  57. }
復制代碼


ID:513258 發表于 2019-9-25 10:36
  1. /*
  2. 【Arduino】108種傳感器模塊系列實驗(資料+代碼+圖形+仿真)
  3. 實驗一百二十四: PS2鼠標 鍵盤插座接口 PS2模塊
  4. 1、安裝< PS2Keyboard.h>庫
  5. (https://www.pjrc.com/teensy/arduino_libraries/PS2Keyboard.zip)
  6. 2、項目:在 Arduino 上使用 PS/2 鍵盤進行輸入測試
  7. 3、PS/2 接口與 Arduino 接腳
  8. 5V :      - Arduino 5V out
  9. Ground : - Arduino GND
  10. Clock :    - Arduino Pin 3
  11. Data :     - Arduino Pin 8
  12. */
  13.    
  14. #include <PS2Keyboard.h>

  15. const int DataPin = 8;
  16. const int IRQpin =  3;

  17. PS2Keyboard keyboard;

  18. void setup() {
  19.   //keyboard.begin(DataPin, IRQpin, PS2Keymap_US);
  20.   keyboard.begin(DataPin, IRQpin, PS2Keymap_German);
  21.   //keyboard.begin(DataPin, IRQpin, PS2Keymap_French);
  22.   Serial.begin(9600);
  23.   Serial.println("International Keyboard Test:");
  24. }

  25. void loop() {
  26.   if (keyboard.available()) {
  27.     char c = keyboard.read();
  28.     Serial.println(c);
  29.   }
  30. }
復制代碼


小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表