# Scan des Adresses I2C pour les capteurs et les actionneurs
import machine
from i2c_lcd import I2cLcd
from time import sleep_ms
i2c = machine.I2C(0, scl=machine.Pin(22), sda=machine.Pin(21))

print('Scan i2c bus...')
devices = i2c.scan()

if len(devices) == 0:
  print("No i2c device !")
else:
  print('i2c devices found:',len(devices))

  for device in devices:  
    print("Decimal address: ",device," | Hexa address: ",hex(device))

print()

# Ecrire sur les deux LCD :
AddressOfLcd_39 = 0x27
AddressOfLcd_40 = 0x28
# Configuration de l'écran LCD 39
lcd_39 =I2cLcd(i2c, AddressOfLcd_39, 2, 16)
lcd_39.move_to(3,0)
lcd_39.putstr('LCD : 39')
lcd_39.move_to(0,1)
lcd_39.putstr("hello ")

# Configuration de l'écran LCD 40
lcd_40 =I2cLcd(i2c, AddressOfLcd_40, 2, 16)
lcd_40.move_to(3,0)
lcd_40.putstr('LCD : 40')
lcd_40.move_to(0,1)
lcd_40.putstr("HELLO")
D0D1D2D3D4D5D6D7GNDLOGIC