Arpitthumar
Posts: 32
Joined: Sat Jun 29, 2019 5:39 am

TypeError: lcd_string() missing 1 required positional argument: 'style'

Thu Aug 01, 2019 5:44 am

I am getting below error while display serial data on lcd.

Error is
lcd_string(rbuff,1)
TypeError: lcd_string() missing 1 required positional argument: 'style'

Code: Select all


  while True:
    rbuff=ser.read()
    lcd_byte(LCD_LINE_1, LCD_CMD)
    lcd_string(rbuff,1)
    time.sleep(1) 


User avatar
lpsw
Posts: 158
Joined: Thu Jun 25, 2015 4:45 pm
Location: USA

Re: TypeError: lcd_string() missing 1 required positional argument: 'style'

Thu Aug 01, 2019 6:02 am

Try:

Code: Select all

lcd_byte(1, LCD_CMD)
lcd_string(rbuff, LCD_LINE_1)
Assuming, of course, that LCD_CMD and LCD_LINE_1 are correct.
Self-education is, I firmly believe, the only kind of education there is - Isaac Asimov

scotty101
Posts: 3735
Joined: Fri Jun 08, 2012 6:03 pm

Re: TypeError: lcd_string() missing 1 required positional argument: 'style'

Thu Aug 01, 2019 8:10 am

Presuming you are following the instructions from https://www.raspberrypi-spy.co.uk/2012/ ... ng-python/

Arguments for the lcd_string function are lcd_string(message,line,style)
1. The message you wish to display
2. The line on which you wish to display the message
3. Style - how you would like the text displayed (1=left justified, 2=centred, 3=right justified)

Try

Code: Select all

lcd_string(rbuff, LCD_LINE_1, 1)
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

Return to “Python”