Outils pour utilisateurs

Outils du site


start:arduino:esp32:smart:micropython

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
start:arduino:esp32:smart:micropython [2025/02/26 17:50] – [Test ouverture porte servoMoteur avec code -.- sur BP1] adminstart:arduino:esp32:smart:micropython [2025/02/26 17:53] (Version actuelle) – [Test LCD] admin
Ligne 542: Ligne 542:
 ==== Test connection Wifi ==== ==== Test connection Wifi ====
  
-<code python exemple016>+<code python exemple016.py>
 import time import time
 import network #Import network module import network #Import network module
Ligne 571: Ligne 571:
     sta_if.disconnect()     sta_if.disconnect()
  
 +</code>
 +
 +==== Test LCD ====
 +
 +<code python exemple017.py>
 +from time import sleep_ms, ticks_ms 
 +from machine import I2C, Pin 
 +from i2c_lcd import I2cLcd 
 +
 +DEFAULT_I2C_ADDR = 0x27
 +
 +i2c = I2C(scl=Pin(22), sda=Pin(21), freq=400000) 
 +lcd = I2cLcd(i2c, DEFAULT_I2C_ADDR, 2, 16)
 +
 +lcd.move_to(1, 0)
 +lcd.putstr('Bonjour')
 +lcd.move_to(1, 1)
 +lcd.putstr('Au Castellab')
 +
 +# The following line of code should be tested
 +# using the REPL:
 +
 +# 1. To print a string to the LCD:
 +#    lcd.putstr('Hello world')
 +# 2. To clear the display:
 +#lcd.clear()
 +# 3. To control the cursor position:
 +# lcd.move_to(2, 1)
 +# 4. To show the cursor:
 +# lcd.show_cursor()
 +# 5. To hide the cursor:
 +#lcd.hide_cursor()
 +# 6. To set the cursor to blink:
 +#lcd.blink_cursor_on()
 +# 7. To stop the cursor on blinking:
 +#lcd.blink_cursor_off()
 +# 8. To hide the currently displayed character:
 +#lcd.display_off()
 +# 9. To show the currently hidden character:
 +#lcd.display_on()
 +# 10. To turn off the backlight:
 +#lcd.backlight_off()
 +# 11. To turn ON the backlight:
 +#lcd.backlight_on()
 +# 12. To print a single character:
 +#lcd.putchar('x')
 +# 13. To print a custom character:
 +#happy_face = bytearray([0x00, 0x0A, 0x00, 0x04, 0x00, 0x11, 0x0E, 0x00])
 +#lcd.custom_char(0, happy_face)
 +#lcd.putchar(chr(0))
 </code> </code>
/home/chanteri/www/fablab37110/data/attic/start/arduino/esp32/smart/micropython.1740588623.txt.gz · Dernière modification : 2025/02/26 17:50 de admin