What's wrong with my simple program?

I tried to use 9v battery to power the Arduino. And it performs better. Although it still becomes no response after I controlled it several times. But the number of times it doesn't react is decreased. I'm not sure if it happened by accident.

Could you please tell me why you execute a loop every 10 seconds? Why I can't just loop without time elapsed.Just like my original code.

And Then I use both the battery and the Computer usb to power the Arduino. It performs even better. Almostly,it responses to all my controls.

Hi Kitty

You can adjust the speed but it's all about giving the App and the Arduino time to perform the task without being 'over run' with instructions - as per ABG's example. Also, consider the purpose of your setup. How often should a plant be watered? If doing so without any technology, you would probably water the plant once per day.

So there we are - the issues can be summarised as:

  1. Insufficient power - mains power adapter recommended;
  2. Attach the servo's signal wire (yellow-ish) to Arduino pin 3
  3. Try to prevent the User from tapping the App Buttons too frequently to prevent App and/or servo lock-up.

Hi, ChrisWard, Thanks a lot for helping me find out the reasons for my problems! But about

I attached the servo's signal wire to Arduino pin 12. it works well.

Hi Kitty

On pin 12, the servo could lose accuracy. That's why they have the PWM signal pins. So try pin3.