我试图用wiringPi's ^{
这是我的密码
import wiringpi2 as wiringpi
# Ä
cap_umlaut_a = [
int('0b01010', 2),
int('0b00100', 2),
int('0b01010', 2),
int('0b10001', 2),
int('0b11111', 2),
int('0b10001', 2),
int('0b10001', 2),
int('0b00000', 2)
]
print(cap_umlaut_a) # [10, 4, 10, 17, 31, 17, 17, 0]
wiringpi.lcdCharDef(lcd_handle, 0, cap_umlaut_a)
运行此代码时,出现以下错误:
TypeError: in method 'lcdCharDef', argument 3 of type 'unsigned char [8]'
我期望这些ints
与unsigned chars
相同
[编辑]
在代码的另一部分中,我使用ord(char)
将一个字符转换为无符号整数。这能导致正确的anser吗?在
如何将数组转换为可接受的类型?在
请注意(据我所知),python wiringPi库只是包装了wiringPi的C函数)
[编辑]
我在github上打开了一个问题:https://github.com/WiringPi/WiringPi2-Python/issues/20
我做了一些研究,找到了相关python绑定at this github repo的源代码。在
有问题的线路是
如您所见,您必须传入python中相当于指向unsigned char的指针。根据this thread,等价物是一个字节字符串。这意味着正确的调用应该是
^{pr2}$相当于
相关问题 更多 >
编程相关推荐