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?
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 >.
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
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?
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