TypeError: unsupported operand type(s) for &: ‘float‘ and ‘int‘

TypeError: unsupported operand type(s) for &: ‘float’ and ‘int’

self.write(self.__LED0_OFF_L+4*channel, off & 0xFF)
self.write(self.__LED0_OFF_H+4*channel, off >> 8)

chage to:

self.write(self.__LED0_OFF_L+4*channel, int(off) & 0xFF)
self.write(self.__LED0_OFF_H+4*channel, int(off) >> 8)

猜你喜欢

转载自blog.csdn.net/pvmsmfchcs/article/details/133151842