Servo problems while using serial monitor [SOLVED]

Hello!

I am pretty new to programming, but I am currently working on a small project with solar tracking.

I have connected two photoresistors, two LEDs for indicating and a servo motor to my bradboard.

The code I have written works fine, but when I first added the servo I could not get this to move at all.
After a bit of troubleshooting I managed to figure out that I had some conflicting line of code preventing the servo from moving.
After deleting one line at a time, testing every time I ended up finding that the "Serial.begin (9600);" line was the line that made this problem.

Now, the servo and everything works fine, but since I don't have the Serial.begin line in my code, I cannot use the serial printer.

Does anyone know why the servo is not working while using the serial printer, and how to combine them both without problems?

Thanks

With the lack of information, I can only guess that you have the servo connected to Arduino pins o and 1. If you disagree, show your wiring schematic and your code, properly posted between < and >.

Paul

You are correct, my servo is connected to pin 0 on the Arduino.
I have attached my code so you can better understand how I have everything connected
Unfortunately my wiring diagram is only in my head at this point

Solar_Tracker_v.1.0.ino (1.02 KB)

1 Like

Move the servo to another pin (not 1).

Don't try to power servos with the Arduino 5V output -- you can damage the Arduino that way.

lafte:
You are correct, my servo is connected to pin 0 on the Arduino.
I have attached my code so you can better understand how I have everything connected
Unfortunately my wiring diagram is only in my head at this point

And pin 0 and 1 are already in use by the serial monitor, so you won't make this mistake again, will you?

Paul

1 Like

I moved the servo to another pin and its working fine now. I have now learned that pin 0 and 1 can not be used when using the serial monitor. Thanks for the lesson guys, I appreciate it :slight_smile:

1 Like