HAT-022 Piano tátil
Declarar a instância
Se acrescentares um bloco de HAT-022 Piano tátil(HAT022) à área de trabalho, no código Python é inserida automaticamente a declaração de instância seguinte:
python
cheesestick = CheeseStick(0)
hat022 = cheesestick.HAT022()Parâmetros
| Nome | Tipo | Descrição | Intervalo / Tipo | Valor predefinido |
|---|---|---|---|---|
| index | Opção de lista | Número da instância (começa em 0) | inteiro ≥ 0 | 0 |
Iniciar o piano tátil
Usa o piano tátil.

Parâmetros
(nenhum)
Python
python
cheesestick = CheeseStick(0)
hat022 = cheesestick.HAT022()
hat022.start()Entrada da tecla
O estado de entrada da tecla escolhida
Se a tecla estiver premida, é devolvido 1; se não estiver premida, 0.

Parâmetros
| Nome | Tipo | Descrição | Intervalo / Tipo | Valor predefinido |
|---|---|---|---|---|
| unit | Opção de lista | Tecla da escala | Dó(C), Dó#(C#), Ré(D), Ré#(D#), Mi(E), Fá(F), Fá#(F#), Sol(G), Sol#(G#), Lá(A), Lá#(A#), Si(B), ◀(left), ▶(right), fn(fn) | - |
Python
python
cheesestick = CheeseStick(0)
hat022 = cheesestick.HAT022()
hat022.key_input('C')A tecla está premida?
Se a tecla escolhida foi clicada

Parâmetros
| Nome | Tipo | Descrição | Intervalo / Tipo | Valor predefinido |
|---|---|---|---|---|
| unit | Opção de lista | Tecla da escala | Dó(C), Dó#(C#), Ré(D), Ré#(D#), Mi(E), Fá(F), Fá#(F#), Sol(G), Sol#(G#), Lá(A), Lá#(A#), Si(B), ◀(left), ▶(right), fn(fn) | - |
Python
python
cheesestick = CheeseStick(0)
hat022 = cheesestick.HAT022()
hat022.key_pressed('C')