Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Based Analog Joystick Interface

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based Analog Joystick Interface

Circuit Documentation

Summary of the Circuit

This circuit consists of an Arduino UNO microcontroller board interfaced with an Analog Joystick (Wokwi Compatible). The joystick provides two-dimensional input to the Arduino, which reads the analog values corresponding to the X (horizontal) and Y (vertical) axes of the joystick. The Arduino is programmed to read these values and output them to the Serial Monitor. This setup can be used for various control applications, such as robotics or game controllers.

Component List

Arduino UNO

Joystick Module

Analog Joystick (Wokwi Compatible)

Wiring Details

Arduino UNO

Joystick Module

Documented Code

// Code for Arduino UNO to read joystick values and print to Serial Monitor

const int xPin = A0, yPin = A1; // Joystick pins connected to Arduino's analog pins
float xValue, yValue; // Variables to store joystick values

void setup() {
  pinMode(xPin, INPUT); // Set the joystick pins as input
  pinMode(yPin, INPUT);
  Serial.begin(9600); // Start serial communication at 9600 baud rate
}

void loop() {
  xValue = analogRead(xPin); // Read the horizontal joystick value
  yValue = analogRead(yPin); // Read the vertical joystick value

  // Print the joystick values to the Serial Monitor
  Serial.print("Value of x-axis: ");
  Serial.println(xValue);
  Serial.print("Value of y-axis: ");
  Serial.println(yValue);

  delay(100); // Wait for 100 milliseconds before reading the values again
}

Note: The code provided is for the Arduino UNO microcontroller. It initializes the serial communication, reads the analog values from the joystick, and prints them to the Serial Monitor. The delay(100) function call is used to limit the rate of data output to the Serial Monitor.