<<=
과 |=
연산자가 파이썬을 의미합니까? 나는 그들이 비트 연산자라고 생각한다. 나는 |
(bitwise 또는) 연산자와 <<
(bit shifting) 연산자를 알고 있지만, =
과 조합해서는 알지 못합니다.'='을 (를) 파이썬에서 비트 연산자에 추가하면 무엇이 있습니까? (예 : '<<'대신 '<<')
조각 번호는 this입니다. 아래의 코드는 해당 코드에 속합니다.
commandout = adcnum
commandout |= 0x18 # start bit + single-ended bit
commandout <<= 3 # we only need to send 5 bits here
for i in range(5):
if (commandout & 0x80):
GPIO.output(mosipin, True)
else:
GPIO.output(mosipin, False)
commandout <<= 1
GPIO.output(clockpin, True)
GPIO.output(clockpin, False)