Source Code
// File - example - Basics - Blink
int led = 13;
// the setup routine runs once when you press reset:
void setup()
{
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop()
{
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(4000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(4000); // wait for a second
}
4개의 LED 모두 ON/OFF
Source Code
void setup()
{
pinMode(13,'output');
pinMode(12,'output');
pinMode(11,'output');
pinMode(10,'output');
}
void loop()
{
digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
digitalWrite(10,HIGH);
delay(2000); //2 seconds
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(10,LOW);
delay(2000);
}
Review
Arduino의 digital 출력핀의 연결법에 대해서 MCU의 전원을 통해서 많은 LED를 이용한다면 시스템이 불안정해진다. 외부 전압을 이용하는 것이 더욱 안정적이다.
No comments:
Post a Comment