Cov txheej txheem:

R/C rau USB Choj: 7 Kauj Ruam
R/C rau USB Choj: 7 Kauj Ruam

Video: R/C rau USB Choj: 7 Kauj Ruam

Video: R/C rau USB Choj: 7 Kauj Ruam
Video: Tus Neeg Ruam - R-Lin Thoj | New Song [ Official MV ] Nkauj Tawm Tshiab 2023 Hmong Song 2023 2024, Hlis ntuj nqeg
Anonim
R/C rau USB Choj
R/C rau USB Choj

Hloov PPM cov cim los ntawm lub mloog xov tooj cua rau hauv txoj haujlwm joystick

Siv nws los ua si koj nyiam kev ua si thiab simulators dav hlau nrog koj R/C lub xov tooj cua xa xov. Cov lus qhia no siv Arduino los ntawm littleBits thiab tus txais DSMX ntxiv rau cov lej yooj yim ua kom hloov pauv no.

Koj yuav xav tau

  • Fais fab
  • Arduino
  • USB kab
  • tus pin headers
  • jumper hlau
  • lub xov tooj cua txais nrog PPM tso tawm.

Kauj Ruam 1: Solder Pin Headers rau Arduino Qhov Ntxiv I/O Ports

Solder Pin Headers rau Arduino Qhov Ntxiv I/O Ports
Solder Pin Headers rau Arduino Qhov Ntxiv I/O Ports

Txhawm rau ua kom lub zog txais (RX), tus pin headers yuav tsum tau ntxiv rau Arduino. Qhov no tseem yuav ua rau cov hlua ntawm Bit thiab RX yooj yim dua. Saib https://discuss.littlebits.cc/t/using-the-additional-i-os-on-the-arduino-bit yog xav paub ntxiv.

Kauj Ruam 2: Ntxiv Arduino Joystick Library rau Koj IDE

Ntxiv Arduino Joystick Library rau Koj IDE
Ntxiv Arduino Joystick Library rau Koj IDE

Koj tuaj yeem nrhiav lub tsev qiv ntawv ntawm GitHub, https://github.com/MHeironimus/ArduinoJoystickLib… Ua tsaug, Matthew Heironimus, rau kev sau nws.

Tsuas yog qee tus Arduinos tuaj yeem ua raws li HID zoo li lub joystick. Raws li lub LittleBits microcontroller yog Arduino Leonardo ntawm lub siab koj zoo mus.

Kauj Ruam 3: Nyem Txoj Cai Rau Arduino

#include #define inputPin 16#txhais raws 4 #def lo lo 800 // kho rau cov zis ntawm RX#txhais tau zoo 1600 // kho kom raug rau RX#txhais cov lim 10int channel [raws]; int yav dhau losValue [raws]; int counter = 0; Joystick_ Joystick (JOYSTICK_DEFAULT_REPORT_ID, JOYSTICK_TYPE_MULTI_AXIS, 0, 0, tseeb, tseeb, cuav, cuav, cuav, tseeb, cuav, cuav, cuav); void setup () {Joystick.setXAxisRange (lo, hais); Joystick.setYAxisRange (lo, nyob zoo); Joystick.setThrottleRange (lo, nyob zoo); Joystick.setRudderRange (lo, nyob zoo); Joystick.begin (); Serial.begin (9600); pinMode (inputPin, INPUT); } void loop () {if (pulseIn (inputPin, HIGH)> 3000) {rau (int i = 0; i <= channels-1; i ++) {channel = pulseIn (inputPin, HIGH); } rau (int i = 0; i <= channels-1; i ++) {if ((channel > 2000) || (channel <500)) {channel = previousValue ; } lwm tus {channel = (yav dhau los Tus nqi +channel )/2; txee ++; }} Joystick.setXAxis (channel [0]); Joystick.setYAxis (channel [1]); Joystick.setThrottle (channel [2]); Joystick.setRudder (channel [3]); } yog (counter> lim) {rau (int i = 0; i <= channels-1; i ++) {Serial.print ("channel"); Serial.print (kuv+1); Serial.print (":"); Serial.println (channel [kuv]); yav dhau losValue = channel ; } suav = 0; }}

Thov nco ntsoov tias cov cai uas txuas nruab nrab ntawm R/C teeb liab thiab emulated USB HID los hauv nws daim ntawv yooj yim tshaj plaws. Lub luag haujlwm siv ntawm no - pulseIn - yog qhov ua haujlwm thaiv. Nyeem ntawm no, thiab ntawm no, yuav ua li cas siv txoj hauv kev tsis thaiv kev siv kev cuam tshuam.

Kauj Ruam 4: Ua Kev Txuas Hluav Taws Xob

Ua qhov thaiv
Ua qhov thaiv
Ua qhov thaiv
Ua qhov thaiv

Txuas jumper hlau / DuPont cables ntawm Bit thiab RX. Cov txuas ntawm qhov kawg ntawm cov kab no yuav tsum yog poj niam. Peb txuas GND (xiav), VCC (xim av) thiab teeb liab (txiv kab ntxwv) los ntawm PPM chaw nres nkoj ntawm RX rau GND, VCC thiab d16 ntawm Arduino.

Kauj Ruam 5: Txheeb Tus Neeg Txais

Tshem tawm Arduino los ntawm lub zog. Muab cov hlua khi rau hauv qhov chaw txuas uas cim BIND ntawm RX. Qhib koj lub xov tooj cua xa xov thiab hloov nws mus rau hauv hom khi. Tom ntej no thov lub zog rau Arduino. Cov txheej txheem khi tau ua tiav thaum LED hauv lub txais tau qhib.

Kauj Ruam 6: Kho Txoj Cai rau Koj Li Cas

Qhov nyob zoo thiab lo hauv Arduino kos duab yuav tsum tau hloov kho kom pom qhov tseeb ntawm cov neeg txais uas koj siv.

#define li 800

#define nyob zoo 1600

Cov cim qhia hauv PPM mem tes zoo li ntawm 1000μs txog 2000μs. RX siv hauv Cov Lus Qhia Qhia Tawm qhov txiaj ntsig kwv yees li ntawm 800 thiab 1600 thiab txawv me ntsis ntawm txhua cov channel. Txhawm rau nrhiav seb qhov twg koj tus neeg txais khoom muaj, qhib Serial Monitor hauv Arduino IDE kom pom qhov tso tawm ntawm koj RX. Nws yuav zoo li qhov no:

tshooj 1: 728

channel 2: 729 channel 3: 703 channel 4: 726 channel 1: 1681 channel 2: 1639 channel 3: 1613 channel 4: 1676

Thaum koj muaj lub tswv yim pom tseeb ntawm qhov ntau uas koj RX tso tawm, xaiv qhov kev kwv yees zoo rau nyob zoo thiab lo thiab hloov qhov tsis sib xws raws li. Tom qab ntawd xa cov duab kos mus rau Arduino dua.

Kauj Ruam 7: Calibrate Emulated Joystick

Nqa tus ntaus ntawv mus rau koj lub khoos phis tawj thiab siv qhov ntsuas qhov ua haujlwm ntawm koj li OS txhawm rau ntsuas qhov ntsuas tus lej. Ib qho cuab yeej zoo rau Linux yog jstest-gtk.

Kev txhim kho ntxiv

  • Sau cov cai tsis txwv (saib Kauj Ruam 3)
  • Teeb cov kab ib channel, tsis yog thoob ntiaj teb (saib Kauj Ruam 6)

Nyeem ntxiv

  • Redcon CM703
  • PPM

Pom zoo: