I am trying to make a servomotor turn and when it reaches 90 degrees a rgb led turns on but this error happened on a line but this line works on a motor sweep. here is my code so far
#include <Servo.h>
Servo myservo;
int G = 10;
int B = 11;
int R = 12;
int pos = 0;
int ledState = 0;
int RGB (10, 11, 12);
void setup() {
myservo.attach(9);
pinMode(G, OUTPUT);
pinMode(B, OUTPUT);
pinMode(R, OUTPUT);
pinMode(9, INPUT);
}
void loop() {
digitalWrite (G, 0);
digitalWrite (B, 0);
digitalWrite (R, 0);
if (myservo.write(pos);){
run(ledState);
}
int digitalState = digitalRead(RGB);
for (pos = 0; pos <= 90; pos += 1;) {
myservo.write(pos)
}
I do not know why it wont work tell me what I am doing wrong and I just made a guess on how to use the run statement tx