General area when it fits no where else

Moderator: Mmiscool

User avatar
By Ecoli-557
#53151 I get an error on the following and I don't understand why. Could someone enhance my learning?
Code: Select allOutPin = hex(ThisPin xor 255) 'this should return a hex value of the inverted value

I am working on code to exercise a MCP23S17 port expander and I want a way to invert the logic as there is no way to directly address the port by individual bit as you can in Arduino.

Any direction would be useful.
Regards to All.
User avatar
By Mmiscool
#53178 Encapsulate the xor evaluation in its own set of parenthesizes.

Code: Select allOutPin = hex((ThisPin xor 255))
User avatar
By Ecoli-557
#53180 Yup, your Da Man!
That works for my MCP23S17 demo. DOn't know why though. I don't see the reason for double (()) around the same function.
Why does this work
Code: Select allOutPin = hex((ThisPin xor 255))

and not this
Code: Select allOutPin = hex(ThisPin xor 255)
User avatar
By Ecoli-557
#53181 Yup, your Da Man!
That works for my MCP23S17 demo. DOn't know why though. I don't see the reason for double (()) around the same function.
Why does this work
Code: Select allOutPin = hex((ThisPin xor 255))

and not this
Code: Select allOutPin = hex(ThisPin xor 255)