Practice: Changing a Delay

Remember earlier when we mentioned the "Hey let's change something and see what happens" programming technique? It is time to put that into practice!

Changing the delay

Go back to your Arduino IDE window and highlight the 1000 in the first delay statement:

Then change that from a 1000 to a 500

Then change the second delay as well:

Now Save it as a new Sketch called MyBlink (or really anything but a descriptive name is wise). When you do that you'll get the warning that it's read-only.

Now before you upload this new, modified sketch to your Arduino I would like you to stop and think!

  • What do you think will be the effect of this change?
  • What will be different and what is the same?

Once you have meditated and you think you are sure of your answer. Click the Verify button (the checkmark button in the quick action button bar) and then the Upload button (arrow button, to the right of checkmark) to send the sketch to your Arduino. Check the status bar to make sure the upload was successful

Were you right about your prediction?

The effect of the change is... now the LED is on for half a second, and off for a half second! The LED is blinking twice as fast.

If the LED is not blinking faster, check:

OK, not crazy exciting yet but it's all about small steps.

This guide was first published on Sep 02, 2016. It was last updated on Sep 02, 2016. This page (Practice: Changing a Delay) was last updated on Nov 15, 2019.