// Name: Rajaram Parida
// Redg: 2241016203
// Section: 2241028
// Date: 10/11/2025
// Experiment: 06
// Objective: 2.3
#include <Servo.h>
Servo myservo;
int joyX = A0;
int servoPin = 9;
void setup() {
myservo.attach(servoPin);
Serial.begin(9600);
}
void loop() {
int xVal = analogRead(joyX);
int angle = map(xVal, 0, 1023, 0, 180);
myservo.write(angle);
Serial.print("Joystick: ");
Serial.print(xVal);
Serial.print(" Servo Angle: ");
Serial.println(angle);
delay(15);
}