Completely uncompiled or tested but something along the line of the following should do the trick -
#define ENTRIES(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))
const uint8_t pinLED_1 = ??; // replace ??? with pin num of LED1
const uint8_t pinLED_2 = ??; // replace ??? with pin num of LED2
const uint8_t pinLED_3 = ??; // replace ??? with pin num of LED3
const uint8_t pinLED_4 = ??; // replace ??? with pin num of LED4
const uint8_t pinLED_5 = ??; // replace ??? with pin num of LED5
const uint8_t pinsLED[] = { pinLED_1, pinLED_2, pinLED_3, pinLED_4, pinLED_6 };
struct pattern_delay_t
{
uint8_t _byte;
uint8_t _delay;
};
uint8_t message[] =
{
{ 0b00010001, 10 }
, { 0b00010011, 10 }
, { 0b00010101, 10 }
, { 0b00011001, 10 }
, { 0b00010001, 10 }
, { 0b00000000, 10 }
, { 0b00001110, 10 }
, { 0b00010001, 30 }
, { 0b00001110, 10 }
, { 0b00000000, 10 }
, { 0b00011111, 10 }
, { 0b00010101, 10 }
, { 0b00010001, 10 }
, { 0b00000000, 10 }
, { 0b00000000, 50 }
};
void loop()
{
for ( int i = ENTRIES(message); i--; )
{
for ( int m = 0b00010000, n = 0; m; m >>= 1, n++ )
{
digitalWrite(pins[n], ((message[i]._byte & m) ? HIGH : LOW));
}
delay(digitalWrite(pinsLED[n]._delay);
}
}
void setup()
{
for ( int i = ENTRIES(pinsLED); i-- )
{
pinMode(pinsLED[i], OUTPUT);
}
}