Joystick Arduino LED Strip Project – Introduction & Current Progress ๐Ÿค–

arduino uno and joystick

I started working on an LED Arduino light strip game based on something cool I saw at a bar out in Brooklyn. I enjoy working with Arduino and programming hardware and thought it would be a fun project and I decided to do it.

Below is an image of the Arduino UNO setup with the joystick controller.

Here you can see a video showing a short demo of the light strip being controlled by the joystick:

The wiring is set up with the Arduino microcontroller with 3 signal connections to the joystick. There is a signal connection from Pin 2, and 2 analog connections from pin A0 and A1. The microcontroller also connects 5V power as well as Ground to the breadboard, allowing ease of connection and multiple port options for 5V and Ground.

The LED strip receives 5V power from the breadboard power strip, and so does the joystick. These are both also connected to the Ground strip of the breadboard.

The current version of the code can be seen here: https://github.com/omartheman/Arduino-2022.git

It is a combination of the LED strip’s code library, a code library for the joystick, and some custom / modified items I have written in. You can take a look at some choice snippets below which allow the joystick’s values to be read by the microcontroller:

  xPosition = analogRead(VRx);
  yPosition = analogRead(VRy);
  SW_state = digitalRead(SW);
  mapX = map(xPosition, 0, 1023, -512, 512);
  mapY = map(yPosition, 0, 1023, -512, 512);

  Serial.print("X: ");
  Serial.print(mapX);
  Serial.print(" | Y: ");
  Serial.print(mapY);
  Serial.print(" | Button: ");
  Serial.println(SW_state);

Above we have some functions from the library which read the x- and y-values of the joystick. We also have some functions that print out these values to the Output Monitor, which we can view on the Arduino Editor webpage. You can view some of these outputs in the image below:

All together the code, Arduino editor, microcontroller and joystick allows me to create a fun game that I have up in my room.

The microcontroller I used was an off-brand Arduino UNO by a brand called Lafvin. I bought it on Amazon for around $32: https://www.amazon.com/gp/product/B07CTFVM1L/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

Subscribe to new blog posts