I am also starting to learn arduino, today is day one.
Ran into this same problem.
- When i load and test the sketch while connected via USB to a laptop, all worked fine.
- but when testing the same setup on power supply the delay at the end of loop was not held.
- Do not write delay statement at the end statement of a loop, I think the arduino is optimized to ignore delay calls if there is no subsequent code (i.e. if the delay is the last line of your code)
- To resolve this issue move the "same delay statement" to the top of the loop (first line) this will work.