What is wrong here?
def check_bit4(input):
newIn = input
mask = 0b01000
desired = newIn & mask
if desired > 0:
return "on"
else:
return "off"
found out what was wrong fixed code above
What is wrong here?
def check_bit4(input):
newIn = input
mask = 0b01000
desired = newIn & mask
if desired > 0:
return "on"
else:
return "off"
found out what was wrong fixed code above
Why are you shifting the input?
def check_bit4(input):
if input > 0b111:
return βonβ
else:
return βoffβ
try this code. this worked for me
really works
def check_bit4(input):
check = 0b1000
if input & check > 0:
return "on"
else:
return "off"