Hi, i have attached 2 servos to robot eyes, one servo is for blinking and the other is for the eyes to look right and left. Both servos are set to operate with random movement open/close, right/left.
I have two issues, i want the eye lids to open, close and open again fast without delay. But sometimes the eye lids close for a few seconds, which makes the robot look like he is sleeping (something i dont want). Basically i want a fast blink, with the eyes always returning to being open.
My second issue is with the eyes, i want them to always start in the center. I then want the eyes to randomly turn right, then go back to center. Then randomly turn left and back to center. Because it currently just turns right to left randomly.
I am very new to this, i just started the other day.
Thank you im advance for anyone who can help.
I am using a Arduino uno R3 attached to a L293D DC Motor Control Shield Module.
I have never seen a robot sleep, so I am at a loss. : )
First, remove the "image" of the code. Next, cut your code (in text) from your post and paste it into the IDE and pressing CTRL-T. Then, cut your formatted code from the IDE. Next, click the < CODE > button in the message box and paste your code where you see type or paste code here.
About your code... you are using a function called delay() which is causing your "sleeping robot." Search "arduino blink without delay" to read about using the function millis()... then give it a try yourself and post what you have learned. See you soon!
I have no idea how to apply millis. I searched, tried to put the code for millis and i keep getting error messages. I have no idea where to put it or how to write it into arduino.