Hello, I have a very weird problem which, after a lot of cutting bits of code out of a larger program, I have simplified down to the following code:
#include <Servo.h>
byte motorPin = 9; // ATTACHED TO A LED FOR TESTING PURPOSES
byte servoPin = 6;Servo s;
void setup() {
//s.attach(servoPin);
}void loop() {
analogWrite(motorPin, 255);
}
Now, the “motorPin” (named so because originally going to control a solid state relay for controlling a DC motor) is attached to an LED to check if it comes on or not.
Now, guess what, with the code as shown above, the LED turns on, no surprises there. With the:
s.attach(servoPin);
line uncommented however, the LED stays off :o
What is going on here? I have tried changing the pin numbers (moved motorPin from 9 to 10) but doesn’t solve the problem. The offending line is the servo attachment to its pin.