Splitting Byte

I have tried to find an answer to my question on here but I cant.
I am writing a program to control some relays and it is receiving a byte as an input, I need a way to split this byte into individual pieces as each bit will control one specific output.

Use switch/case on your ‘byte’ variable.

Look up how to ‘mask’ bits on a variable.



arduino mask bits


The easy way bitRead() - Arduino Reference

More difficult Arduino Playground - BitMath

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.