> For the complete documentation index, see [llms.txt](https://monasheng.gitbook.io/zerotohero/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://monasheng.gitbook.io/zerotohero/arduino-zero-to-hero/core-skills/flashing-code.md).

# Flashing Code

{% embed url="<https://www.youtube.com/watch?v=gIJGA5H3ZOs>" %}

While Arduino boards can be used a glorified batteries to provide [Constant Power](/zerotohero/arduino-zero-to-hero/core-skills/constant-power.md), their real strength comes in reading sensor data and outputting signals *programatically* - as a function of  code that you write and *flash* to the device.

Flashing code to your [Arduino IDE](/zerotohero/arduino-zero-to-hero/arduino-ide.md) is a very straightforward process:

1. Write your code in the IDE [Arduino IDE](/zerotohero/arduino-zero-to-hero/arduino-ide.md#coding-window), using [Arduino C](/zerotohero/arduino-zero-to-hero/arduino-programming/arduino-c.md).
2. Plug your Arduino board into the computer, and select the appropriate COM Port and board name from the [Arduino IDE](/zerotohero/arduino-zero-to-hero/arduino-ide.md#flashing-interface).
3. Verify the code is error-free using the Verify (tick) button.
4. Load the code onto the board using the Flash (arrow) button.

## An Example

The below code is called `blink`, and is the Arduino Equivalent of `Hello World` - about the simplest hardware interaction you can have with an Arduino board.&#x20;

In [Input/Output Pins](/zerotohero/arduino-zero-to-hero/core-skills/input-output-pins.md) and [digitalWrite()](/zerotohero/arduino-zero-to-hero/core-skills/input-output-pins/digital-pins/digitalwrite.md), we'll talk about how this code works. For now, you can take for granted that it does.

```arduino
/*
  Blink
  Turns an LED on for one second, then off for one second, repeatedly.
  by Scott Fitzgerald, Arturo Guadalupi, Colby Newman
  This example code is in the public domain.
  https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
*/

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(1000);                      // wait for a second
  digitalWrite(LED_BUILTIN, LOW);   // turn the LED off by making the voltage LOW
  delay(1000);                      // wait for a second
}
```

Here's what flashing this code to an Arduino board looks like:

<figure><img src="/files/gGQoAzIuPcAektt0waJO" alt=""><figcaption><p>You can copy/paste this code directly into the Arduino IDE to flash it to the board. If you do, the onboard LEDs will illuminate rapidly during the flashing process, before the steady-state blink code kicks in.</p></figcaption></figure>
