Coding help - read from a Paket and trigger digital pin on bit change

Hi,
Looking for some coding help. I have a device that outputs to a data stream that is read by an Uno.
Ive done the code that reads the stream successfully, but what I want to do now is trigger 2 digital pins based on the value of Byte 5 as it changes
Below is the Output

FF 0 0 0 3 0 0 0 30 32 Time (ms) =405

The value it outputs is 0, 4, 8 and 12
I want one digital pin to trigger on 4, the other on 8 and both on 12

Code attached.

Any ideas?

FaveroFullArm_ExtensionDecoder.ino (5.15 KB)

Take a look at the bitRead() function or consider using the bit mask functionality available in C, ie &, |, ^ etc

Please follow the advice on posting a programming question given in Read this before posting a programming question

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here

Hi,
Have tried the bit read function. Byte 5 of my string defines the state of the lamps

Bit D2 = RED lamp (left)
Bit D3 = GREEN lamp (right)
1 is on and 0 is off

What im not clear on is how to use bitread() to specifically read bits 2 and bit 3 in byte 5 of my string " Buffer1"

Im clear how to trigger a digital pin from the bit read command - triggering the LED below

if (bitRead(???,2) == 1) {
digitalWrite(LED_BUILTIN, HIGH);

if (bitRead(???,2) == 1) {
digitalWrite(LED_BUILTIN, HIGH);

Not using code tags strikes again

What im not clear on is how to use bitread() to specifically read bits 2 and bit 3 in byte 5 of my string " Buffer1"

What are you not clear about ?

byte bit2 = bitRead(buffer1[5], 2);  //read bit 2 of byte 5 of buffer1 array
byte bit3 = bitRead(buffer1[5], 3);
byte bit5 = bitRead(buffer1[5], 5);

So Sorry, :confused:
Im new to all this so apologies for not following correct protocol

Thanks - Your help is doing what I want with the code