Storing following commands

Hi everyone

I'm new to the arduino-community and I have a problem that is maybe very easy.
In my project I need to use some following commands such as:
digitalWrite(13, HIGH);
digitalWrite(13, LOW);
a lot.
I wondered if there was a way to store those 4 under 1 name or command so I can use it quicker and easier.

Yes, you can use functions:

Have a look at how functions are used in Planning and Implementing a Program


PS ... Full marks for asking the question. Many newbies just repeat the code over and over which makes the program very long and makes it very easy to make silly mistakes when repeating chunks of code.

While you are at it don't get into the habit of using delay(), in answer to the question "why is my program slow and unresponsive?", which you will be asking in a month or 3, it's because of all the delays.

When you've worked out how to make a function have a read of:
Using millis for timing
Demonstration for several things at the same time

Enjoy experimenting! :slight_smile: