I want to change a bit whose location in a byte I choose, whose value I choose.
Example:
~ I have byte:
10000000
~ I write at location 3 bit 1
and the byte should become
10001000
I tried this, with no luck:
I want to change a bit whose location in a byte I choose, whose value I choose.
Example:
~ I have byte:
10000000
~ I write at location 3 bit 1
and the byte should become
10001000
I tried this, with no luck:
You mean like this,
I have divide the length into two half and worked but if the procedure want to repeat for particular length then have to work a few more with the blocks
Or look for this extension
But this will convert dec to binary
your blocks only seem to work if i want to change bit value at a predefined location,
but i want to be able to change the bit in a byte whose position I choose, and whose value (1 or 0) i choose
i need something like this: bitWrite() - Arduino Reference
btw that addon only does conversion
Thanks! Your solution looks the most simple and it most importantly actually works, so again, thanks.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.