UCUq sans interface

UCUq sans interface #

Cliquez sur l’encart pour lancer le programme. Pour réduire l’encart, cliquez à nouveau sur son en-tête.

Vous pouvez modifier le programme directement dans l’éditeur et le relancer avec le bouton Run.

Remise à zéro globale #

import ucuq lcd = ucuq.HD44780_I2C(ucuq.SoftI2C(6, 7), 4, 20).backlightOn() oled = ucuq.SSD1306_I2C(128, 64, ucuq.I2C(8,9)).fill(1).show() ring = ucuq.WS2812(20, 8).fill([30,30,30]).write() ucuq.PWM(5, freq=500).setNS(0) ucuq.sleep(0.5) lcd.backlightOff() ring.fill([0,0,0]).write() oled.fill(0).show()

SSD1306 (OLED) #

PRENOM = """ """ import ucuq, datetime oled = ucuq.SSD1306_I2C(128, 64, ucuq.I2C(8, 9)) def display(prenom, y): if prenom: oled\ .text("Bien le bonjour,", 0, y)\ .text(f"{prenom} !", 0, y+10)\ .text("Merci pour votre", 0, y+45)\ .text("participation !", 0, y+55)\ .show() else: oled\ .text("Test accompli le", 0, y+20)\ .text(f"{datetime.datetime.now().strftime("%d/%m/%Y %H:%M")}", 0, y+40)\ .show() oled.fill(1).show() ucuq.sleep(0.5) oled.fill(0).show() ucuq.sleep(0.5) for i in range(64): oled.fill(0) display(ucuq.toASCII(PRENOM.strip()), 64-i)

Buzzer #

FREQ = 440 import ucuq buzzer = ucuq.PWM(5, freq=FREQ, u16 = 32000) ucuq.sleep(1) buzzer.setU16(0)

WS2812 (LEDs RGB) #

R = 0 G = 30 B = 0 COUNT = 8 import ucuq ucuq.WS2812(20, COUNT).fill([R,G,B]).write()

HD44780 (LCD) #

import datetime LINE_1 = "Hello, World!" LINE_2 = f"{datetime.datetime.now().strftime("%d/%m/%Y %H:%M")}" import ucuq lcd = ucuq.HD44780_I2C(ucuq.SoftI2C(6, 7), 4, 20) lcd\ .putString(LINE_1)\ .moveTo(0,1)\ .putString(LINE_2)\

Suite #

Avec Blockly.