Day 1 01 - LED

2024. 1. 15. 18:45arduino

const int ledPin = 13;

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

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

간단하게 13번 디지털 핀에 연결해서 LED를 키는 코드이다.

'arduino' 카테고리의 다른 글

Day1 06_LED8  (0) 2024.01.17
Day1 05_millis(라이브러리 호출)  (0) 2024.01.17
Day1 04_LED_mission  (0) 2024.01.17
Day 1 03 - for LED  (0) 2024.01.15
Day 1 02 - serial  (0) 2024.01.15