char LED_pin[] = (8,9,10,11};
void send2port(byte data);
void setup()
{
Serial.begin (9600);
for(char i=0;i<4;i++)
{
pinMode(LED_pin[i],OUTPUT);
}
}
void loop()
{
Serial.println("17Pichayud_18Panupong_28Apinan");
Serial.println("Panupong");
Serial.println("Pattern 1");
Serial.println(" ");
send2port(0B1000);
delay(300);
send2port(0B0100);
delay(300);
send2port(0B0010);
delay(300);
send2port(0B0001);
delay(300);
Serial.println("18Panupong");
Serial.println("Panupong");
Serial.println("Pattern 2");
Serial.println(" ");
send2port(0B1001);
delay(300);
send2port(0B0110);
delay(300);
send2port(0B0110);
delay(300);
send2port(0B1001);
delay(300);
Serial.println("18Panupong");
Serial.println("Panupong");
Serial.println("Pattern 3");
Serial.println(" ");
send2port(0B0010);
delay(300);
send2port(0B0001);
delay(300);
send2port(0B1000);
delay(300);
send2port(0B0100);
delay(300);
Serial.println("18Panupong");
Serial.println("Panupong");
Serial.println("Pattern 4");
Serial.println(" ");
send2port(0B0101);
delay(300);
send2port(0B1010);
delay(300);
send2port(0B0101);
delay(300);
send2port(0B1010);
delay(300);
}
void send2port(byte data)
{
digitalWrite(LED_pin[0],(data& 1 )? HIGH:LOW);
digitalWrite(LED_pin[1],(data& 2 )? HIGH:LOW);
digitalWrite(LED_pin[2],(data& 4 )? HIGH:LOW);
digitalWrite(LED_pin[3],(data& 8 )? HIGH:LOW);
}