Joystick Game

A small tutorial project that tells you what direction your joystick is pointing in when you push it.

Jun 29, 2018

20975 views

12 respects

Components and supplies

1

Analog joystick (Generic)

1

Breadboard (generic)

1

Jumper wires (generic)

1

LED (generic)

1

Arduino UNO

1

USB-A to B Cable

Project description

Code

The code

arduino

This is the code that you will paste into your editor in order to make this project work.

Downloadable files

The schematic

This will help you to connect all your components together as the wiring in my image was a mess.

The schematic

The schematic

This will help you to connect all your components together as the wiring in my image was a mess.

The schematic

Comments

Only logged in users can leave comments

Anonymous user

2 years ago

Those LEDs should have series current limiting resistors. In the range of 330 to 860 Ohms (for typical values). Without those, the UNO has to work too hard trying do drive enough current through to get the voltage drop to 5 volts. Normal LEDs use around (depending mostly on the colour) half of that. The UNO does not know that, and tries to keep it at 5Volts (when turned on). The LED keeps using more current, trying to pull that down to its *characteristic* voltage. The LED will 'win', and the UNO pin maxes out on the current it can supply. Not good for the UNO.

tylerpeppy

2 years ago

Thank you so very much for the tips.

Anonymous user

2 years ago

Your schematic does not show anyh joystick. and the parts list indicates 1 LED and schematic shows 5. ????

Anonymous user

2 years ago

It's cool but not a game

Anonymous user

2 years ago

just a question, why does power need to be delivered to the power bus if it is only sending the current to one pin on the joystick

Anonymous user

2 years ago

Power does not **need** to be on the power bus. It is a convenience / convention only. Only the joystick actually needs power in this circuit. So power **could** be run direct there instead of to the bus. Making a habit of powering the bus means power is always available, in case something else is added.

Anonymous user

3 years ago

This project does not work at all. Started off with only one light coming on when you move the joystick, and fixed the code a little to get two on, but I couldn't figure out how to get the other two on.

Anonymous user

3 years ago

It's cool but not a game

Anonymous user

6 years ago

just a question, why does power need to be delivered to the power bus if it is only sending the current to one pin on the joystick

Anonymous user

2 years ago

Power does not **need** to be on the power bus. It is a convenience / convention only. Only the joystick actually needs power in this circuit. So power **could** be run direct there instead of to the bus. Making a habit of powering the bus means power is always available, in case something else is added.

Anonymous user

6 years ago

Your schematic does not show anyh joystick. and the parts list indicates 1 LED and schematic shows 5. ????

Anonymous user

6 years ago

Those LEDs should have series current limiting resistors. In the range of 330 to 860 Ohms (for typical values). Without those, the UNO has to work too hard trying do drive enough current through to get the voltage drop to 5 volts. Normal LEDs use around (depending mostly on the colour) half of that. The UNO does not know that, and tries to keep it at 5Volts (when turned on). The LED keeps using more current, trying to pull that down to its *characteristic* voltage. The LED will 'win', and the UNO pin maxes out on the current it can supply. Not good for the UNO.

tylerpeppy

2 years ago

Thank you so very much for the tips.