使用python

时间:2015-08-22 08:16:09

标签: python raspberry-pi

我的代码是:

import serial
s="Hello"
a=serial.Serial('/dev/ttyAMA0',9600)
while True:
  a.write(s)

错误:

TypeError: 'str' does not support the buffer interface

1 个答案:

答案 0 :(得分:0)

修正此行:

a.write(s)

使用:

a.write(s.encode())