It's time to start programming. Here we will examine both text-based coding and ArduBlock which is a Graphical User Interface (GUI) allowing people to program the Arduino by dragging and dropping blocks around the screen. To get started using either of these, first launch the Arduino IDE. Then make sure you tell it which type of Arduino you are using. For our projects, we're using the Arduino Nano so click Tools >> Board >> Arduino Nano. When you're ready to upload, you need to plug the Arduino into the computer and select the port it's connected to by clicking Tools >> Port >> COM3 (or whatever number appears there).
Anytime you write a program or sketch for the Arduino, you need two sections. The first section is called setup, which runs once at the start of the program. The second section is loop, which, not surprisingly, continues to loop endlessly. The code for these sections looks like this:
void setup()
{
}
void loop()
{
}
Between the curly brackets { } is where you write the code for each of the two main sections. Every Arduino program needs to have these two parts. Later, you can create new sections like these, but you can't replace or omit these.
If you're using ArduBlock, you don't have to type any code. Once you've told it what type of Arduino you have, click Tools >> ArduBlock. This will launch another window. Notice the colored categories along the left side of the new window. Clicking on any of those will bring up a list of available blocks to use. Now, just because you aren't typing the setup and loop doesn't mean you don't need them. The first thing you need to start with in ArduBlock is a program so click Control and drag out the top block. It should look like this:
This has space for the setup and loop sections of your code. Let's start with some activities.