Project 1 Arduino

This is a simple sketch for Arduino that flashes an LED connected to pin 13.

Requirements

To run this script, you must have:

  • a compatible Arduino board

  • One LED

  • A resistor (if necessary to limit the current)

  • Connecting cables

Connection

Connect the LED to pin 13 on the Arduino board. Be sure to use a resistor (usually 220 ohms) in series with the LED to limit the current and protect the LED.

Instructions

  1. Load the sketch into the Arduino IDE.

  2. Connect the Arduino board to the computer via USB cable.

  3. Select the correct board type and port in the Arduino IDE.

  4. Load the sketch onto the Arduino board.

  5. Observe the LED flashing at regular one-second intervals.

Code

#define LED 13 // LED connected to pin 13

void setup() {
    pinMode(LED, OUTPUT); // Set the pin as output
}

void loop() {
    digitalWrite(LED, HIGH); // Turn on the LED
    delay(1000);             // Wait a second
    digitalWrite(LED, LOW);  // Turn off the LED
    delay(1000);             // Wait a second


}

License

Questo script è rilasciato sotto la Licenza MIT.

Last updated