แบบฝึกหัดที่ 2

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(1000);
    digitalWrite(led1,LOW);digitalWrite(led2,HIGH);
    digitalWrite(led3,LOW);digitalWrite(led4,LOW);
    delay(1000);
    digitalWrite(led1,LOW);digitalWrite(led2,LOW);
    digitalWrite(led3,HIGH);digitalWrite(led4,LOW);
    delay(1000);
    digitalWrite(led1,LOW);digitalWrite(led2,LOW);
    digitalWrite(led3,LOW);digitalWrite(led4,HIGH);
    delay(1000);
}




ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

7 Segment Display Interfacing with PIC Microcontroller

arduino Project (อ้างอิง : https://www.prometec.net/control-acceso-clave/)

Digital Thermometer using LM35 and PIC Microcontroller