#include <Servo.h> //Include library to work with Servo motor
//Create Servo object, used to control a Servo (access functions, etc)
Servo myServo; //12 Servo objects can be created on most boards
//Define a variable to store the values of joystick in horizontal direction
const int analogPin = A0; //To read value in x-direction from joystick
//Define variable to store the Servo position, to rotate Servo in loop()
int value = 0; //Will be converted from analog input to angle output
//(see the map() function used in main loop() below)
//setup code, to run once:
void setup() {//setup
pinMode(analogPin, INPUT); //Set SW_pin for input mode
Serial.begin(9600); //Open serial port at 9600 baud
//Attach the Servo on pin 9 to the Servo object
myServo.attach(9);
}//setup
//main code, to run repeatedly:
void loop() {//loop
//Read in 10-bit analog value (0 to 1023) from joystick
value = analogRead(analogPin); //value variable will convert to degrees
//Use map() to convert values to degrees (0 to 180) for Servo motor
value = map(value, 0, 1023, 0, 180);
//Use the converted value to move the Servo
myServo.write(value); //Move to a position specified by value (0 to 180)
delay(15); //Then wait 15ms
}//loop
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
servo1:GND
servo1:V+
servo1:PWM
joystick1:VCC
joystick1:VERT
joystick1:HORZ
joystick1:SEL
joystick1:GND