thank you, I am very new to code etc... but I think I have fixed those problems you mentioned but aren't totally sure, the loop is again working in the simulator but just want to be sure
here is the updated code and loop
// C++ code
//
#include <Servo.h>
Servo servo_9;
Servo servo_10;
Servo servo_8;
void setup()
{
if (digitalRead(5) == LOW) {
// switch is on
}
// or
if (digitalRead(5) == HIGH) {
// switch is off
}
pinMode(5, INPUT_PULLUP);
servo_9.attach(9, 500, 2500);
pinMode(3, INPUT_PULLUP);
servo_10.attach(10, 500, 2500);
pinMode(4, INPUT_PULLUP);
servo_8.attach(8, 500, 2500);
}
void loop()
{
if (digitalRead(5) < 1) {
delay(500); // Wait for 500 millisecond(s)
servo_9.write(60);
delay(500); // Wait for 500 millisecond(s)
} else {
servo_9.write(0);
}
if (digitalRead(3) < 1) {
delay(500); // Wait for 500 millisecond(s)
servo_10.write(60);
delay(500); // Wait for 500 millisecond(s)
} else {
servo_10.write(0);
}
if (digitalRead(4) < 1) {
delay(500); // Wait for 500 millisecond(s)
servo_8.write(60);
delay(500); // Wait for 500 millisecond(s)
} else {
servo_8.write(0);
}
}
