#picaxe 08M2
dirsc = %01000
b0 = pinsc
main:
do
if b0 <> pinsc then
b0 = pinsc
b7 = bit4
endif
loop
You may have missed this hidden in WA55's answer, but this is much simpler then the other options discussed here:sorry for posting this if it has been posted before, but I've been struggling with how to read a specific bit of a variable, i.e., x = b0,4 where x is my control, b0 is the byte, and 4 is the bit.
Any simple ideas?
Available only for X1 and X2 parts (not M2 or older M or X parts)@ lbenson : There's the "IF <var> BIT <num> SET/CLEAR THEN..." command which can be used but no GETBIT as such. I've made a note of that.
Also hidden, perhaps, in my answer: "b7 = bit4". Sorry if I confused by wrapping this in a way to toggle that value in the simulator.You may have missed this hidden in WA55's answer
...
my_var = bit4
I guess the problem is that at times those in the know think that they have provided a clear explanation but it is sufficiently obtuse that the newbie does not receive/understand the intended "core" message.Also hidden, perhaps, in my answer: "b7 = bit4". Sorry if I confused by wrapping this in a way to toggle that value in the simulator.