Could there be an error in the code?
You could say that, yes. Let's list all the syntax errors to start with:
#include <servo.h>
Servo myservoa;
myservob; // This has no type. It's just a word by itself.
myservoc; // This has no type. It's just a word by itself.
myservod; // This has no type. It's just a word by itself.
int myservoa=10; // You already defined myservoa as a Servo type.
myservob=55; // This has no type. It's just a word by itself.
myservoc=25; // This has no type. It's just a word by itself.
myservod=125; // This has no type. It's just a word by itself.
void setup()
{
myservoa.attach(2) // Semicolons must terminate all statements.
myservob.attach(3) // Semicolons must terminate all statements.
myservoc.attach(4) // Semicolons must terminate all statements.
myservod.attach(5) // Semicolons must terminate all statements.
}
void loop()
{
for pos=10;pos<=75;pos+=1; // Braces are missing, pos is not defined, and extra ;
{
myservoa.write(pos);
delay(1000);
}
for pos=55;pos<=100;pos+=1; // Braces are missing, pos is not defined, and extra ;
{
myservob.write(pos) // Semicolons must terminate all statements.
delay (1800) // Semicolons must terminate all statements.
}
for pos=25;pos<=165;pos+=1; // Braces are missing, pos is not defined, and extra ;
{
myservoc.write(pos) // Semicolons must terminate all statements.
delay (1000) // Semicolons must terminate all statements.
}
for pos=125;pos<=170;pos+=1; // Braces are missing, pos is not defined, and extra ;
{
myservod.write(pos) // Semicolons must terminate all statements.
delay (1800) // Semicolons must terminate all statements.
}
}
You really need to get to grips with the syntax of a language before you start programming in that language. I count just 6 lines (not including { and }) of valid C code there, and two of them are handed to you by the IDE.
Void
andInt
to lower case. But you really have to describe, what your actual problem is. You should get error messages during compilation. It is mandatory to add those to your question (click at "edit" under your question do directly editing it)