Cov txheej txheem:

Arduino LED Tswj Nrog Analog Joystick: 6 Cov Kauj Ruam
Arduino LED Tswj Nrog Analog Joystick: 6 Cov Kauj Ruam

Video: Arduino LED Tswj Nrog Analog Joystick: 6 Cov Kauj Ruam

Video: Arduino LED Tswj Nrog Analog Joystick: 6 Cov Kauj Ruam
Video: How to make a STEEL MARBLE TRACK with basic tools! step by step guide 2024, Kaum ib hlis
Anonim

Hauv qhov kev qhia no peb yuav kawm paub siv analog Joystick los tswj lub LED.

Saib daim vis dis aus.

Kauj ruam 1: Yam Koj Yuav Tsum Tau

Koj Yuav Tsum Tau Dab Tsi
Koj Yuav Tsum Tau Dab Tsi
Koj Yuav Tsum Tau Dab Tsi
Koj Yuav Tsum Tau Dab Tsi
Koj Yuav Tsum Tau Dab Tsi
Koj Yuav Tsum Tau Dab Tsi
Koj Yuav Tsum Tau Dab Tsi
Koj Yuav Tsum Tau Dab Tsi
  • Arduino UNO (lossis lwm yam Arduino)
  • 4 XLED
  • Joystick
  • 4X Resistor 220Ω (lossis qee yam zoo sib xws)
  • Cov qhob cij
  • Jumper xov hlau
  • Visuino program: Rub tawm Visuino

Kauj ruam 2: Circuit Court

Qhov Circuit
Qhov Circuit
  • Txuas Arduino tus pin [5V] rau breadboard tus pin zoo [kab liab]
  • Txuas Arduino tus pin [GND] rau breadboard tus pin zoo [kab xiav]
  • Txuas Joystick tus pin [VRx] rau Arduino Analog tus pin [1]
  • Txuas Joystick tus pin [VRy] rau Arduino Analog tus pin [0]
  • Txuas Joystick tus pin [+5V] rau Breadboard tus pin zoo [kab liab]
  • Txuas Joystick tus pin [GND] rau Breadboard tus lej tsis zoo [kab xiav]
  • Txuas txhua tus LED tsis zoo tus pin ntawm lub khob cij rau lub khob cij tsis zoo tus pin GND [kab xiav]
  • Txuas txhua tus tiv thaiv rau LED tus pin zoo ntawm lub khob cij
  • Txuas arduino digital pin [2] rau thawj tus tiv thaiv
  • Txuas arduino digital pin [3] rau tus tiv thaiv thib ob
  • Txuas arduino digital pin [4] rau tus tiv thaiv thib peb
  • Txuas arduino digital pin [5] mus rau tus tiv thaiv plaub

Kauj ruam 3:

Duab
Duab
Duab
Duab

Txhawm rau pib ua haujlwm rau Arduino, koj yuav tsum muaj Arduino IDE teeb tsa los ntawm no:

Thov nco ntsoov tias muaj qee qhov teeb meem tseem ceeb hauv Arduino IDE 1.6.6. Nco ntsoov tias koj nruab 1.6.7 lossis siab dua, txwv tsis pub Cov Lus Qhia no yuav tsis ua haujlwm! Yog tias koj tsis tau ua raws cov kauj ruam hauv Phau Ntawv Qhia no teeb tsa Arduino IDE rau program Arduino UNO! Visuino: https://www.visuino.eu tseem yuav tsum tau teeb tsa. Pib Visuino raws li pom hauv thawj daim duab Nyem rau ntawm "Cov cuab yeej" khawm ntawm Arduino tivthaiv (Daim Duab 1) hauv Visuino Thaum qhov kev sib tham tshwm, xaiv "Arduino UNO" raws li qhia hauv daim duab 2

Kauj Ruam 4: Hauv Visuino ADD & Txuas Cheeb Tsam

Hauv Visuino ADD & Txuas Cov Khoom Siv
Hauv Visuino ADD & Txuas Cov Khoom Siv
Hauv Visuino ADD & Txuas Cov Khoom Siv
Hauv Visuino ADD & Txuas Cov Khoom Siv
Hauv Visuino ADD & Txuas Cov Khoom Siv
Hauv Visuino ADD & Txuas Cov Khoom Siv
  • Ntxiv 4X "Sib piv Tus Nqi Analog" tivthaiv
  • Xaiv "CompareValue2" thiab hauv cov khoom qhov rai teeb tsa "Tus nqi" rau 1
  • Xaiv "CompareValue4" thiab hauv cov khoom qhov rai teeb tsa "Tus nqi" rau 1
  • Txuas Arduino AnalogIn [0] rau "CompareValue1" tus pin [Hauv] thiab "CompareValue2" tus pin [Hauv]
  • Txuas Arduino AnalogIn [1] rau "CompareValue3" tus pin [Hauv] thiab "CompareValue4" tus pin [Hauv]

  • Txuas "CompareValue1" tus pin [Tawm] rau Arduino tus lej digital [2]
  • Txuas "CompareValue2" tus pin [Tawm] rau Arduino tus lej digital [3]
  • Txuas "CompareValue3" tus pin [Tawm] rau Arduino tus lej digital [4]
  • Txuas "CompareValue4" tus pin [Tawm] rau Arduino tus lej digital [5]

Kauj Ruam 5: Tsim, Ua Ke, thiab Tshaj Tawm Arduino Code

Tsim, Sau, thiab Tso Tawm Arduino Code
Tsim, Sau, thiab Tso Tawm Arduino Code

Hauv Visuino, hauv qab nyem rau ntawm "Tsim" Tab, xyuas kom tseeb tias qhov chaw nres nkoj raug xaiv, tom qab ntawd nyem rau ntawm "Compile/Build and Upload" khawm.

Kauj ruam 6: Ua si

Yog tias koj ua lub zog Arduino UNO module, thiab txav txoj haujlwm joystick lub LED yuav nyem.

Nrog koj zoo siab! Koj tau ua tiav koj txoj haujlwm nrog Visuino. Kuj txuas nrog yog Visuino project, uas kuv tau tsim rau Cov Lus Qhia no, koj tuaj yeem rub tawm nws ntawm no thiab qhib nws hauv Visuino:

Pom zoo: