osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NEWBIE: how to get text onto 2 lines on a 16x2 lcd display


On 26/09/19 9:14 PM, RobH wrote:
> I have some sample/demo python code for scrolling and outputting text 
> onto a 16x2 lcd display.
> 
> I would like to put my own message or text outputting to the lcd on 2 
> lines. I have tried using lcd.message('my message',1) and 
> lcd.message('my message', 2), but the output says:
> 
> TypeError: message() takes exactly 2 arguments (3 given)
> 
> I have also seen this on the, stackexchange site:
> lcd_string("your text " + str(yourVar), 1)
> 
> But what is str(yourVar), as I assume it means a variable.
> If I could have a working example please, that would be great.


I'm wondering if "lcd_string" should be "lcd.string" (per "lcd.message") 
  - would it be better to post the actual (not) working code?

Suggest you fire-up the Python REPR:

	python3		# on a Linux terminal

then:

	import ***whatever the LCD package is called ***
	help( ***whatever...called *** )

The output from this will tell you the names of all the entities within 
the package. Within that you will be able to check for the pertinent 
class (from which lcd was derived) and see what it says about arguments 
for the message() and/or string() methods - particularly the number of 
arguments and their data-type(s).
-- 
Regards =dn