Blink | Arduino Documentation
Turn an LED on and off every second.
概览

收录于
2026年3月17日
学科与领域
computer-science-advanced · embedded-systems
年级范围
五年级–十二年级(高四)
页面类型
Tutorial
简介
Arduino Blink Tutorial
- Objective: Learn to blink the on-board LED, the simplest physical output task for an Arduino.
- Hardware Requirements: Arduino board, optional external LED, and a 220-ohm resistor.
- Key Constant:
LED_BUILTINis used to reference the built-in LED pin, which varies by board (most commonly D13). - Circuit Safety: A resistor is required when using an external LED to limit current and prevent damage to the board or LED.
- Ohm's Law Application: Use $V = IR$ to calculate the appropriate resistor value based on board voltage (5V or 3.3V) and LED forward voltage.
- Core Code Functions:
pinMode(LED_BUILTIN, OUTPUT);: Initializes the pin.digitalWrite(LED_BUILTIN, HIGH);: Turns the LED on (supplies voltage).digitalWrite(LED_BUILTIN, LOW);: Turns the LED off (0 volts).delay(1000);: Pauses the program for 1000 milliseconds (1 second).
- Accessing the Example: Available in the Arduino IDE via File > Examples > 01.Basics > Blink.
- Next Steps: The documentation recommends exploring
BlinkWithoutDelayfor non-blocking timing andDigitalReadSerialfor input handling. - Last Revision: 2015/07/28.
用户评价
暂无已发布的评价,欢迎率先分享您的使用体验。