That first Serial.println() statement is crap.
What's wrong with it ?
What meaning has setCounter == 5 got in your program ?You are calling the servo() function from 8 places in your code. That can't be right, can it ? You only need to call it when the clock time equals the requested feed time.I have just realised something. You don't seem to have any form of clock in your program to compare the feeding times with, or have I missed something fundamental ?
Is there a limit to the delay () function? As in the max milis value it can take?
Parametersms: the number of milliseconds to pause (unsigned long)
I have just realised something. You don't seem to have any form of clock in your program to compare the feeding times with, or have I missed something fundamental ?
So what is meant by unsigned long? And is 3600000 fits in an unsigned long?
QuoteSo what is meant by unsigned long? And is 3600000 fits in an unsigned long?It's time you became acquainted with the reference page.
Unsigned long variables are extended size variables for number storage, and store 32 bits (4 bytes). Unlike standard longs unsigned longs won't store negative numbers, making their range from 0 to 4,294,967,295 (2^32 - 1).
By the way, I still don't understand the many calls to servo(). It seems unnecesary somehow.
There are other ways of creating a delay that do not use delay() and they don't suffer from the number of milliseconds ever being too big and also allow the system to do other things while the wait goes on but I suggest that you get the basics working first, which you seem to be close to doing.
calculate numberOfTimesToFeed from information entered by the userput the delays between feeds in an array waitingTimesset feedcounter =0 while feedcounter less than numberOfTimesToFeed set wait time to waitingTimes[feedcounter] wait move servo increment feedcounter exit while if feedcounter equals numberOfTimesToFeed else go back and do it again
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16