Hi, i got a Problem with my code for a solar powerbank.
Servos are connected to external power supply and they change their position like i want them to do e.g. (S1.write(90))
But if Servo should move plattform ( //+ and //- ) it doesn´t move.
Serial print "move right", "move left" and "dont turn", "pressed", "notpressed" and "stand by" works fine.
I need to storage the servo position somewhere but my way doesnt work.
PS: im a relative beginner, so maybe i incorrectly used the Servo commands ?!
If neither of those servos ever move then they are not connected correctly or they don't have enough power. At the very least the first write(90) and write(0) should work.
BTW I'm not sure if you realise that servo.read() just returns the last position that was written to the servo. That may or may not be the actual current servo position. Also it is pointless attaching the servos every time round loop. The attach() should be done once in setup().
S1. moves as i want him to move when i push the switch. but he doesnt moves further. (to track the light -> Code: //+ and //- )
S2. just puts the plattform up. this also works
As you have edited your original post so it says something completely different and my comments no longer make any sense I've lost interest. Good luck,
I didn´t said something complete different!
A not moving Servo was the Problem. I think you didnt read the Post properly.
I explicitly wrote, that the Plattform is not moving with a hint to the right place in the Code...
the problem was the "servoR = servoR-=1;"
I changed it to " --servoR" and added an "analogRead" for both sensors in every condition.
works fine now.
This was my first Post in this Forum and I´m a little disappointed.
The problem is, that you should not change your first post if you found a solution. If you do so, all answers, that refer to your post don't make sense anymore. You should edit your first post only for formal changes. E.g. adding code tags if you forgot to do so.
If you found a solution to your problem and changed your code accordingly show that in a new post.
As always when people communicate with each other, there are some rules that need to be followed.