打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
2-Axis Joystick

2-Axis Joystick

Item code: 27800


What It Can Do

  • Miniature two-axis analog joystick with up/down and left/right action
  • Spring-loaded movement always returns joystick to center position
  • Easy plug-in module for use in breadboards and custom circuits

The 2-Axis Joystick provides a simple and convenient way to add X-Ycontrol to a project. A potentiometer attached to each axis providesproportional feedback of the up/down and left/right positions. Thejoystick is spring-loaded, so that it always returns to its centeredposition when you release it.

Depending on the microcontroller you use, a small assortment ofexternal components is required to complete the connection. These arenoted in the Parts List. Refer to the appropriate diagram under Basic Wiring.


Parts List

  • 2-Axis Joystick
  • BASIC Stamp HomeWork Board, Propeller QuickStart, or Arduino Uno microcontroller
  • 22 gauge solid conductor hookup wire
  • (2) 220 Ω resistors, 1/8 or 1/4 watt, 5% tolerance (BASIC Stamp and Propeller interface)
  • (2) 0.01 μF ceramic disc capacitors (BASIC Stamp and Propeller interface)

Basic Wiring

  • Interface: Dual 10 k Ω potentiometers with common ground
  • Power consumption: 0.01W
  • Dimensions: 1.64 x 1.2 x 1.1 in (41.67 x 30.54 x 27.7 mm)

Program KickStarts

The examples in this KickStart display the instantaneous values ofthe X and Y (Left/Right, and Up/Down) axes of the joystick. The valuesare displayed in a debug window or serial monitor.

The range of values returned is dependent on the type of interfaceused between the joystick and microcontroller. The values noted beloware approximate, and are based on the circuitry described in Basic Wiring.

Microcontroller Range Center Position
BASIC Stamp 1–60 30
Propeller 0–6000 3000
Arduino 0–1023 512

 


BASIC Stamp HomeWork Board

Download BASIC Stamp 2 code for the 2-Axis Joystick

' {$STAMP BS2}

' {$PBASIC 2.5}UDPin   CON   8LRPIn   CON   9LR      VAR   WordUD      VAR   WordDOHIGH LRPinPAUSE 2RCTIME LRPin, 1, LRHIGH UDPinPAUSE 2RCTIME UDPin, 1, UDDEBUG HOME, "UD = ", DEC UD, ", LR = ", DEC LR, CLREOLPAUSE 50LOOP

Note: When this program is run the BASIC Stamp Debug Terminal will automatically open.

Propeller QuickStart

Download Propeller Spin code for the 2-Axis Joystick

OBJpst        : "FullDuplexSerial"rc         : "RCTime"CON_clkmode = xtal1 + pll16x_xinfreq = 5_000_000PUB Go | UD, LRpst.start(31, 30, 0, 115200)repeatrc.rctime(0, 1, @LR)rc.rctime(1, 1, @UD)pst.Str(String("UD = "))pst.dec(UD)pst.Str(String(", LR = "))pst.dec(LR)pst.tx(13)waitcnt(clkfreq / 2 + cnt)       ' 1/2 second delay

Important!This program uses the FullDuplexSerial.spin and RCtime.spin objectlibraries, which are included with the Propeller Tool software download.

Note: To view the results of the demonstration,after uploading is complete run the Parallax Serial Terminal from theRun menu, or press F12. Momentarily depress the Reset button on thePropeller QuickStart board to restart the program.

Arduino Uno

Download Arduino 1.0 Code for the 2-Axis Joystick

Download Arduino Pre-release Version Code for the 2-Axis Joystick

This program code is compatible with Arduino 1.0 and earlier versions.

int UD = 0;int LR = 0;void setup() {Serial.begin(9600);}void loop() {UD = analogRead(A0);LR = analogRead(A1);Serial.print("UD = ");Serial.print(UD, DEC);Serial.print(", LR = ");Serial.println(LR, DEC);delay(200);}

Note: To view the results of thedemonstration, after uploading is complete click the Serial Monitor iconin the Arduino IDE. This displays the Serial Monitor window.Momentarily depress the Reset button on the Arduino board to restart thesketch

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
利用ARDUINO LEONARDO自制指点杆
unity nintendo switch(NS)手柄按键映射
Getting Started with the Arduino/Genuino 101
基于arduino的心率检测仪
HC05蓝牙模块的使用
两个arduino板进行串口通讯实验
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服