I have a list of integers that represents solenoid numbers to turn ON ,e.g.
[1, 3, 4, 7], where number “1” represents the 1st solenoid, "3 the 3rd solenoid etc,
so this list means turn solenoids 1, 3, 4 and 7 ON, all the others OFF.
I need to output this as a bit-mapped byte where each bit (0 to 7) represents solenoids 1 to 8 respectively.
So for the above case this would look like the following bit-mapped byte 01001101 in binary.
Is there a Python library that will handle this for me, or does anyone have a code snippet that they can share please?