งานปฏิบัติ 1 LED
int led1 = 7;int led2 = 6;int led3 = 5;int led4 = 4;
void setup()
{
pinMode(led1,OUTPUT);pinMode(led2,OUTPUT);
pinMode(led3,OUTPUT);pinMode(led4,OUTPUT);
}
void loop()
{
digitalWrite(led1,HIGH);digitalWrite(led2,LOW);
digitalWrite(led3,LOW);digitalWrite(led4,LOW);
delay(100);
digitalWrite(led1,LOW);digitalWrite(led2,HIGH);
digitalWrite(led3,LOW);digitalWrite(led4,LOW);
delay(100);
digitalWrite(led1,LOW);digitalWrite(led2,LOW);
digitalWrite(led3,HIGH);digitalWrite(led4,LOW);
delay(100);
digitalWrite(led1,LOW);digitalWrite(led2,LOW);
digitalWrite(led3,LOW);digitalWrite(led4,HIGH);
delay(100);
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น