It’s technically possible, as you can do whatever you want after receiving a downlink. But especially given the pin names like “siren” you probably want something different: How can i remotely control a siren?
That said, unstested, it could be as simple as:
if (i > 0) {
// Parse 8 boolean flags from single byte, using bitwise AND with
// patterns such as B00000001, B00000010, ..., B10000000:
bool flag0 = (rcv[0] & 1<<0) > 0;
bool flag1 = (rcv[0] & 1<<1) > 0;
bool flag2 = (rcv[0] & 1<<2) > 0;
// or:
bool flag3 = (rcv[0] & B00001000) > 0;
bool flag4 = (rcv[0] & B00010000) > 0;
bool flag5 = (rcv[0] & B00100000) > 0;
// or:
bool flag6 = (bitRead(rcv[0], 6) == 1);
bool flag7 = (bitRead(rcv[0], 7) == 1);
// Not a recommended LoRaWAN use case
digitalWrite(flash, flag0 ? HIGH : LOW);
digitalWrite(siren, flag1 ? HIGH : LOW);
}
See Working with bytes.
(As for your earlier if(cont == 'exact message I send from ttn') note that LoRaWAN application data is encrypted, so you don’t need to be afraid that just anyone can send a downlink to your device.)