跳到主要內容

V-USB Joystick for Arduino

上次做好沒存檔

這次再翻出來從弄一次...QAQ
花了我一天阿阿阿阿

D+ 接腳2
D-  接腳3
詳情請看usbconfig.h

想改搖桿配置可以用
HID Descriptor Tool
改完記得回usbconfig.h填
USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH
長度




程式碼:https://www.dropbox.com/s/n0rgkb370wto2lv/UsbJOY.rar?dl=0

留言

  1. Hi, Sir ! your library is amazing ! amazing ! the best library on entire world ! 8 buttons ! fantastic ! congratulations ! you're a genius ! just one question: how the axis X and Y works ? because i'm trying to play a game, like a test , and the character go up even if i'm not press any button. How can I manage the axis ? i want to make a simple gamepad with up,. down, left , right and the 8 buttons. Can you help me, please ?

    Thank you !

    *Ps: Again, amazing library !

    Greetings !

    回覆刪除
    回覆
    1. 使用
      analogRead(PinX); analogRead(PinY);
      去讀取數值並設置
      UsbJoystick.setX(ValueX);UsbJoystick.setY(ValueY);

      use
      analogRead (PinX); analogRead (PinY);
      To read and set values
      UsbJoystick.setX (ValueX); UsbJoystick.setY (ValueY);

      -----------------------------------------------------------
      const int PinX = A0;
      const int PinY = A1;

      ValueX= analogRead(PinX);
      ValueY= analogRead(PinY);
      UsbJoystick.setX(ValueX >> 3); //X,Y 範圍 0~127
      UsbJoystick.setY(ValueY >> 3);

      //我沒測試過
      //需要自己在修改
      // I have not tested
      // Need to modify them again

      刪除
    2. Sorry, Sir ! I'm late to thank you! I got it ! I used the map function! thank you for this magnificent work! thank you so much ! with a bluetooth module HC-06 and a android device, I created a simple application. With this application, you can simulate a Bluetooth gamepad, although there is no "multitouching".

      The application is made in the "App Inventor 2". Therefore, there is no way to enable multitouching. But it works! I do not know how to thank you. Also, you have that V-USB MIDI library. I'm trying to make a MIDI adapter for an old Yamaha keyboard. You are very talented ! Westerners need to learn from you.

      You come to also modify the V-USB Keyboard and Mouse libraries? If yes, please, if you can make them available, I would greatly appreciate it. Their V-USB libraries are much more efficient and objective than those made in the Western Continent.

      If you want the code that did and the application of "BTGamepad" based on your project, please just ask me when you want.

      Thank you very much !

      刪除
    3. V-USB Keyboard and Mouse libraries can be found here

      http://coopermaa2nd.blogspot.tw/2011/10/v-usb-examples-for-arduino.html

      http://coopermaa2nd.blogspot.com/2011/10/v-usb-for-arduino-usbkeyboard.html

      :)

      刪除

張貼留言

這個網誌中的熱門文章

小蟻智慧攝影機支援RTSP

來源: http://en.miui.com/thread-196713-1-1.html 小蟻智慧攝影機版本: 1.8.5.1l_201511061661(台灣版) 下載檔案 https://drive.google.com/file/d/0ByjBix7wpeJJY0ZWZXlvWl9Za1E/view?usp=sharing 把攝影機SD卡拿讀卡機讀取 把壓縮檔內的test資料夾放進SD根目錄 插回SD卡至攝影機 重開 攝影機會呈現橘燈並執行更新 等恢復至藍燈或是用app確認攝影機開啟 用VLC或相關程式讀取串流 Main stream:rtsp:// <CameraIP> :554/ch0_0.h264 Minor stream:rtsp:// <CameraIP> :554/ch0_1.h264 Audio stream:rtsp:// <CameraIP> :554/ch0_3.h264 Telnet與FTP開啟加上 # Telnet if [ ! -f "/etc/init.d/S88telnet" ]; then     echo "#!/bin/sh" > /etc/init.d/S88telnet     echo "telnetd &" >> /etc/init.d/S88telnet     chmod 755 /etc/init.d/S88telnet fi # FTP echo "#!/bin/sh" > /etc/init.d/S89ftp echo "tcpsvd -vE 0.0.0.0 21 ftpd -w / &" >> /etc/init.d/S89ftp chmod 755 /etc/init.d/S89ftp User:  root Password:  1234qwer 使用passwd改密碼 參考: http://en.miui.com/thread-224653-1-1.html

Ollama AMD GPU 支援

AMD Radeon RX 6300(gfx1034)為例 本次為官方不支援 LLVM Target 參考 ollama-for-amd 安裝ROCmLibs for HIP SDK 6.1.2 AMD HIP SDK for Windows 官方支援GPU 下載ollama https://github.com/likelovewant/ollama-for-amd/releases 執行Ollama 於資料夾執行ollama: ollama serve AMD Radeon RX 6300 為gfx1034 LLVM Target 回應不支援GPU: msg="amdgpu is not supported (supported types:[gfx1030 gfx1100 gfx1101 gfx1102 gfx906])" gpu_type=gfx1034 gpu=0 library="C:\\Program Files\\AMD\\ROCm\\6.1\\bin" 下載gfx1034 ROCm https://github.com/likelovewant/ROCmLibs-for-gfx1103-AMD780M-APU/releases/tag/v0.6.1.2 將rocblas.dll及library 備份後刪除 C:\Program Files\AMD\ROCm\6.1\bin\rocblas.dll C:\Program Files\AMD\ROCm\6.1\bin\rocblas\library 將下載後的gfx1034 ROCm解壓後放置於 C:\Program Files\AMD\ROCm\6.1\bin\rocblas.dll C:\Program Files\AMD\ROCm\6.1\bin\rocblas\library 重新執行 執行ollama: ollama serve 本次已找到適應版本 msg="inference compute" id=0 library=rocm variant="" compute=gfx1034 driver=6.1 name="AMD R

蘑菇蘑菇咕咕雞

在 夢中,我的旅程開始於一個神秘的印度轉機站,目的地卻不明。飛機上,我遇到了一個像 Kobo Kanaeru 的女孩。她活潑可愛,說話帶著印度口音,但又像在模仿網紅般的風趣。她用英語向我介紹當下的景點,提到了一座超長的橋或峽谷,說長達 "1 million"(一百萬?),但我完全聽不懂,想表達你好厲害,但完全不知道英文該怎麼說,只能尷尬地微笑點頭。 落地後,我和這個女孩在一個戶外咖啡廳的座位上聊天。她興奮地提到一家名為「MoKumoku bukubuku」的碳烤餐廳,還說這是她最愛的地方之一。我們聊了許多,她提議晚上六點半一起逛街。我提到我的姐姐也一起來到這個城市,或許可以一起同行。回到飯店後,我果然看見姐姐正在辦理入住,我跟她說了這個計畫,她也爽快地答應一起去。 到六點半時,我、姐姐和女孩碰面,開始愉快地聊天。 談話間,女孩突然拿出一張照片,是當年我當兵的一位組長照片。她沒有多說什麼,只是微微一笑,把照片放在桌上。我看著那張照片,腦海中開始浮現各種可能性,這張照片和我有什麼關聯?她似乎在暗示什麼,讓我不禁聯想到我前女友。我的前女友正是我們組長的姐姐,而這個女孩的年紀和模樣,讓我開始懷疑她可能與我前女友有關,甚至可能是她的女兒。但她並沒有明說,一切都只是我的猜測。 氣氛變得微妙,女孩忽然說她要離開,匆匆跑去找一位男子。姐姐看著她的背影,低聲提醒我:「她可能有別的企圖,小心點。」不久後,女孩果然帶著那位陌生男子回來,試圖說服我們去另一間他們推薦的飯店住。男子信誓旦旦地說,那邊免費且服務更好,但他們的態度讓人感覺不對勁。 我不禁心生警惕,試探地問女孩:「這到底是什麼意思?為什麼非要我們去那間飯店?」女孩含糊其詞,只說那裡環境更適合我們,還暗示有其他驚喜。我直接回絕了她的提議,表示不需要任何免費服務。女孩的表情瞬間變得複雜,但沒有繼續勉強。 最後,女孩與那男子無奈離開。姐姐在旁邊冷笑道:「看吧,我就說是個陷阱。」 我望著他們的背影,心中思緒翻湧,最後忍不住嘀咕:「這是什麼最新的詐騙手段嗎?」