Joypix updates


Today we started to make the enclosure for our camera on tinkercad, we also went over the code that moves the joystick vertically and horizontally.

Getting Serial Read from Arduino:

void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue1 = analogRead(A0);
int sensorValue2 = analogRead(A1);
// print out the value you read:
Serial.println(“sensorValue1: “);
Serial.println(sensorValue1);
Serial.println(“sensorValue2: “);
Serial.println(sensorValue2);
delay(100); // delay in between reads for stability
}

Mapping Analog Values from Sensor to Servo Angle:

void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
myServo1.attach(14);
myServo2.attach(15);
}

// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
val1 = analogRead(A0);
val2 = analogRead(A1);
val1 = map(val1, 0, 1023, 0, 179);
myServo1.write(val1);
val2 = map(val2, 0, 1023, 0, 179);
myServo2.write(val2);
delay(10);
}

http://www.youtube.com/watch?v=iFyJMHEz0W0 This is a short videos to how the joy stick moves the pantel bracket.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s