IDE: How to pick a single bit out of an integer

I connected a HCS01.1E to a ctrlX Core via EtherCat.
To get acces to the integrated I/O of the HCS01 I added the parameter P-0-0303.
This parameter is of type integer.

Now the question: How do I get out a single bit of this integer to use it as an boolean "input" in the IDE?

Best reply by richstone

I could solve it with the following function!

JavaScript;
function BitPicker (ValuenumberBitPosnumber) {
    let newNumber = Value & BitPos;
return tools.toBoolean(newNumber)
}

Blockly:

You can integrate (drag and drop) the attached .png directly into your IDE.

tiger-screenshot.png
352.93KB
View original
1 reply