![]() Just make sure all the pieces go in the right place and in the correct orientation. When no order for assembling is provided, soldering the smallest components in first is a good rule to follow. With the vertical " ↑ V" pointing away from you, start moving the joystick around.īelow you'll find a suggested order for assembling the shield, your personal preference might give you other ideas on how to proceed and that's fine too. Open the serial monitor at 9600 baud to begin seeing the raw output values. ![]() Select = digitalRead(SEL) // will be HIGH (1) if not pressed, and LOW (0) if pressed Horizontal = analogRead(HORIZ) // will be 0-1023 Vertical = analogRead(VERT) // will be 0-1023 * old method to turn on the pull-up resistor for the SEL line initialize variables for analog and digital values This sketch outputs serial data at 9600 baud (open Serial Monitor to view). Also connect the joystick VCC to Arduino 5V, and joystick GND to Arduino GND. Connections to joystick (change if you use different pins): The joystick outputs two analog voltages (VERT and HORIZ), and one digital signal (SEL) for the pushbutton. This sketch shows the basic operation of the Thumb Joystick (COM-09032) and breakout board (BOB-09110). Written by: Mike Grusin, SparkFun Electronics 3/11 ![]() Modified by: Ho Yun "Bobby" Chan, SparkFun Electronics, 2/19 Select Arduino/Genuino Uno as the board, the COM port that it enumerated on, and hit the upload button. ![]() Copy the code and paste it in the Arduino IDE. If you're using a different microcontroller, the steps should be similar you'll just need to determine how to read analog and digital inputs on your device. Here's an example Arduino sketch which sets up the microcontroller to read the inputs, and then continuously prints the values to the serial monitor. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |