printf("ho_tari\n");

EX01_Binary_LED 본문

Arduino

EX01_Binary_LED

호타리 2023. 9. 2. 12:39
const int LED[6] = {3, 5, 6, 9, 10, 11};
int cnt = 0;

void setup() {
  // put your setup code here, to run once:
  for(int i = 0; i < 6; i++)
  {
    pinMode(LED[i], OUTPUT);
  }

}

void loop() {
  // put your main code here, to run repeatedly: 
  for(int i = 0; i < 6; i++)
  {
      digitalWrite(LED[i], cnt & (0x01<<i) ? HIGH : LOW);
  }

  cnt++;
  delay(1000);

}

'Arduino' 카테고리의 다른 글

EX03_Binary_LED_Interrupt  (0) 2023.09.02
EX02_DC_MOTOR  (0) 2023.09.02
17_Multi_Task  (0) 2023.09.02
16_Keypad_4x4  (0) 2023.09.02
15_ArrayFND  (0) 2023.09.02