Knop+2 servos software help!!!!!

can someone get this code working???
"#include <Servo.h>

Servo myservo1; // create servo object1 to control a servo
Servo myservo2; // create servo object2 to control a servo
int potpin0; // analog pin used to connect the potentiometer
int potpin1; // analog pin used to connect the potentiometer
int val0; // variable to read the value from the analog pin
int val1; // variable to read the value from the analog pin

void setup()
{
myservo1.attach(9); // attaches the servo on pin 9 to the servo object1
}

{
myservo2.attach(8); // attaches the servo on pin 8 to the servo object2
}

void loop()
{
val = analogRead(potpin0); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}

{
val = analogRead(potpin1); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}" :-/

This is really in the wrong area of the forum, and you haven’t defined for us what “working” means to you.

However:

#include <Servo.h>

Servo myservo1;  // create servo object1 to control a servo 
Servo myservo2;  // create servo object2 to control a servo 
int potpin0;  // analog pin used to connect the potentiometer [glow]this needs a value, otherwise it is always going to be zero[/glow]
int potpin1;  // analog pin used to connect the potentiometer[glow]this needs a value, otherwise it is always going to be zero[/glow]
int val0;    // variable to read the value from the analog pin
int val1;    // variable to read the value from the analog pin

void setup() 
{ 
 myservo1.attach(9);  // attaches the servo on pin 9 to the servo object1 
 myservo2.attach(8);  // attaches the servo on pin 8 to the servo object2 
}


void loop() 
{ 
[glow]// you haven't declared anything called "val".[/glow]
[glow] val[/glow] = analogRead(potpin0);            // reads the value of the potentiometer (value between 0 and 1023) 
 [glow]val[/glow] = map([glow]val[/glow], 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180) 
[glow]// You haven't declared anything called "myservo" [/glow]
[glow]myservo[/glow].write([glow]val[/glow]);                  // sets the servo position according to the scaled value 
 delay(15);                           // waits for the servo to get there [glow]why not just wait once for both to reach their positions?[/glow]

 [glow]val[/glow] = analogRead(potpin1);            // reads the value of the potentiometer (value between 0 and 1023) 
 [glow]val[/glow] = map([glow]val[/glow], 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180) 
 [glow]myservo[/glow].write([glow]val[/glow]);                  // sets the servo position according to the scaled value 
 delay(15);                           // waits for the servo to get there 
}

I mean can anyone get this code to work with two servos.
I suck at coding :frowning:

#include <Servo.h>

Servo myservo1; // create servo object1 to control a servo
Servo myservo2; // create servo object2 to control a servo
int potpin0; /0/ analog pin used to connect the potentiometer0
int potpin1; /1/ analog pin used to connect the potentiometer1
int val0; // variable to read the value from the analog pin
int val1; // variable to read the value from the analog pin

void setup()
{
myservo1.attach(9); // attaches the servo on pin 9 to the servo object1

myservo2.attach(8); // attaches the servo on pin 8 to the servo object2
}

void loop()
{
val = analogRead(potpin0); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
myservo0.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there

val = analogRead(potpin1); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
myservo1.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}

can anyone get this code to work with two servos

You can either define “working” or “not working”, one being what you want and expect to happen, and the other being how what you observe differs from this.

You haven’t given values to either potpin, as pointed out in reply #1.
Also, as highlighted in reply #1, you haven’t declared anything called “val”.[edit]You also haven’t declared anything called “myservo0”[/edit]

Hint: A simple way of getting two similar things to work is to understand how one thing works, then introduce some loops and arrays.