TypeError:参数1必须是字符串,而不是int

时间:2017-08-03 05:42:26

标签: python raspberry-pi adafruit

在树莓上,我使用Adafruit CharLCD收到此消息: 我不明白为什么它会谈论一个必须是字符串的论证。

Traceback (most recent call last):
  File "./lcd.py", line 52, in <module>
    main()
  File "./lcd.py", line 39, in main
    lcd = LCD.Adafruit_CharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7, lcd_columns, lcd_rows, lcd_backlight)
  File "build/bdist.linux-armv7l/egg/Adafruit_CharLCD/Adafruit_CharLCD.py", line 143, in __init__
  File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/GPIO.py", line 278, in setup
TypeError: argument 1 must be string, not int

这是我的代码:

#LCD variables
lcd_rs= 18
lcd_en= 23
lcd_d4= 12
lcd_d5= 16
lcd_d6= 20
lcd_d7= 21
lcd_backlight= 4
lcd_columns= 16
lcd_rows= 2


lcd = LCD.Adafruit_CharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7, lcd_columns, lcd_rows, lcd_backlight)

lcd.message('Humidite %s' %(humidity))

1 个答案:

答案 0 :(得分:-2)

解决了我的问题: 缺少Adafruit_python_GPIO。 安装好了,现在一切都很好! 谢谢大家