So far I have my Arduino Uno communicating with Vixen 3 with no problems , using SET LEVEL I of course can make the servo turn one way but not the other way . I am usually pretty good at figuring stuff out , but this one has gotten me stumped as I cant seem to find anything to help out. Last year I built a 3 axis skull controlled by thumb sticks and had a head set so when you talked its jaw would move ( sound threw speakers of course ) . This year I would like to animate it to a few songs . I kinda understand the values val1, 0, 255 , I thought the intensity lower value would be left and higher value would be right . Anyways Here is the Arduino code I am using to start out with for the first time.

#include <Servo.h>
Servo Pumpkin1;
Servo Pumpkin2;
Servo Pumpkin3;
int pos = 0;

int Chan1 = 3; //PWM-Servo 1
int Chan2 = 5; //PWM-Servo 2
int Chan3 = 6; //PWM-Servo 3
int Chan4 = 9; //PWM-Light 1
int Chan5 = 10; //PWM-Light 2
int Chan6 = 11; //PWM-Light 3
int Chan7 = 12; //extra
int Chan8 = 13; //extra



int i = 0; // Loop counter
int incomingByte[8]; // array to store the 25 values from the serial port
int val1;
int val2;
int val3;

//setup the pins/ inputs & outputs
void setup()
{
Serial.begin(9600); // set up Serial at 9600 bps

pinMode(Chan1, OUTPUT);
Pumpkin1.attach(3);
pinMode(Chan2, OUTPUT);
Pumpkin2.attach(5);
pinMode(Chan3, OUTPUT);
Pumpkin3.attach(6);
pinMode(Chan4, OUTPUT);
pinMode(Chan5, OUTPUT);
pinMode(Chan6, OUTPUT);
pinMode(Chan7, OUTPUT);
pinMode(Chan8, OUTPUT);
}

void loop()
{ // 8 channels are coming in to the Arduino
if (Serial.available() >= 8) {
// read the oldest byte in the serial buffer:
for (int i=0; i<9; i++) {
// read each byte
incomingByte[i] = Serial.read();
}
//Pumpkin1
val1 = incomingByte[0];
val1 = map(val1, 0, 255, 0, 45); //Change the last number according to how far you want the pumpkin to open.
Pumpkin1.write(val1);
delay(15);
//Pumpkin2
val2 = incomingByte[1];
val2 = map(val2, 0, 255, 0, 45); //Change the last number according to how far you want the pumpkin to open.
Pumpkin2.write(val2);
delay(15);
//Pumpkin3
val3 = incomingByte[2];
val3 = map(val3, 0, 255, 0, 45); //Change the last number according to how far you want the pumpkin to open.
Pumpkin3.write(val3);
delay(15);

analogWrite(Chan4, incomingByte[3]); //Light 1
analogWrite(Chan5, incomingByte[4]); //Light 2
analogWrite(Chan6, incomingByte[5]); //Light 3
digitalWrite(Chan7, incomingByte[6]); //Extras
digitalWrite(Chan8, incomingByte[7]); //Extras
}
}

Add TipAsk QuestionCommentDownload