mirror of
				https://gitlab.sectorq.eu/jaydee/ansible.git
				synced 2025-10-31 02:11:10 +01:00 
			
		
		
		
	init
This commit is contained in:
		
							
								
								
									
										35
									
								
								playbooks/files/scripts/lcd_control_start.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								playbooks/files/scripts/lcd_control_start.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | ||||
| # Import LCD library | ||||
| from RPLCD import i2c | ||||
|  | ||||
|  | ||||
| # constants to initialise the LCD | ||||
| lcdmode = 'i2c' | ||||
| cols = 20 | ||||
| rows = 4 | ||||
| charmap = 'A00' | ||||
| i2c_expander = 'PCF8574' | ||||
|  | ||||
| # Generally 27 is the address;Find yours using: i2cdetect -y 1  | ||||
| address = 0x27  | ||||
| port = 0 # 0 on an older Raspberry Pi | ||||
|  | ||||
| # Initialise the LCD | ||||
| lcd = i2c.CharLCD(i2c_expander, address, port=port, charmap=charmap, | ||||
|                   cols=cols, rows=rows) | ||||
| lcd.clear() | ||||
| line1 = f'{"####": <20}' | ||||
| line2 = f'{"Starting....": <20}' | ||||
| line3 = f'{"####": <20}' | ||||
| line4 = f'{"####": <20}' | ||||
| lcd.backlight_enabled =  True | ||||
| lcd.cursor_pos = (0, 0) | ||||
| lcd.write_string(line1) | ||||
| lcd.crlf() | ||||
| lcd.write_string(line2) | ||||
| lcd.crlf() | ||||
| lcd.write_string(line3) | ||||
| lcd.crlf() | ||||
| lcd.write_string(line4) | ||||
| lcd.crlf() | ||||
| lcd.clear() | ||||
| lcd.close(clear=True) | ||||
		Reference in New Issue
	
	Block a user
	 jaydee
					jaydee