Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
lehrkraefte:blc:informatik:glf19:oxocard:oxohack [2019/10/31 21:23] Ivo Blöchliger |
lehrkraefte:blc:informatik:glf19:oxocard:oxohack [2019/11/07 07:39] (current) Ivo Blöchliger [In TigerJython Gerät "ESP32" und COM-Port setzen] |
||
---|---|---|---|
Line 8: | Line 8: | ||
<code text comports.ps1> | <code text comports.ps1> | ||
[System.IO.Ports.SerialPort]:: | [System.IO.Ports.SerialPort]:: | ||
+ | Write-Host -NoNewLine 'Press any key to continue...'; | ||
+ | $null = $Host.UI.RawUI.ReadKey(' | ||
</ | </ | ||
- | ==== Gerät " | + | ==== In TigerJython |
- | Im Menü Datei -> Einstellungen -> Bibliotheken den Punkt " | + | In TigerJython, |
==== Beispiel-Code ==== | ==== Beispiel-Code ==== | ||
<code python oxohack.py> | <code python oxohack.py> | ||
- | # | + | # Nur weil wir mit verrammelter Hard- und Software |
- | from machine import Pin, deepsleep, ADC, reset | + | # arbeiten müssen, heisst das noch nicht, dass wir |
- | from globals import __np | + | # uns nicht amüsieren können ;-) |
- | import time | + | # |
- | + | # Initialisierung der Oxocard | |
- | Pin(2, Pin.OUT).value(1) # audio ampli on | + | try: |
- | Pin(15, Pin.OUT).value(0) # neopix on | + | |
- | time.sleep(0.5) | + | from globals import __np |
+ | import time | ||
+ | Pin(2, Pin.OUT).value(1) # audio ampli on | ||
+ | Pin(15, Pin.OUT).value(0) # neopix on | ||
+ | __np.set(37, | ||
+ | # Möglichkeit zum Ausschalten... | ||
+ | for i in range(50): | ||
+ | if Pin(13, Pin.IN, Pin.PULL_DOWN).value() == 1 and Pin(27, Pin.IN, Pin.PULL_DOWN).value() == 1: | ||
+ | print(" | ||
+ | for k in [250, 100, 50, 20, 10, 5, 1, 0]: | ||
+ | for i in range(8): | ||
+ | __np.set(9*i+1, | ||
+ | __np.set(7*i+8, | ||
+ | __np.show() | ||
+ | time.sleep(0.5) | ||
+ | Pin(2, Pin.OUT).value(0) # audio ampli off | ||
+ | Pin(15, Pin.OUT).value(1) # neopix off | ||
+ | deepsleep() | ||
+ | time.sleep(0.02) | ||
+ | except ImportError: | ||
+ | pass | ||
################################### | ################################### | ||
# Start vom eigentlichen Programm # | # Start vom eigentlichen Programm # | ||
################################### | ################################### | ||
+ | |||
from oxocard import * | from oxocard import * | ||
- | + | ||
bigTextScroll(" | bigTextScroll(" | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | ################################################# | ||
- | # ENDE vom eigentlichen Programm | ||
- | # OxoCard ausschalten mit beiden Knöpfen rechts # | ||
- | ################################################# | ||
- | |||
- | while Pin(13, Pin.IN, Pin.PULL_DOWN).value() == 0 or Pin(27, Pin.IN, Pin.PULL_DOWN).value() == 0: | ||
- | time.sleep(0.1); | ||
- | clear(BLACK); | ||
- | def _toPix(x, y): | ||
- | return 8 * y + x + 1 | ||
- | for k in [250, 100, 50, 20, 10, 5, 1, 0]: | ||
- | for i in range(8): | ||
- | __np.set(_toPix(i, | ||
- | __np.set(_toPix(7 - i, i), k << 16, update = False) | ||
- | | ||
- | | ||
- | Pin(2, Pin.OUT).value(0) # audio ampli off | ||
- | Pin(15, Pin.OUT).value(1) # neopix off | ||
- | deepsleep() | ||
- | |||
- | |||
</ | </ | ||
==== OxoCard wieder in Originalzustand setzen ==== | ==== OxoCard wieder in Originalzustand setzen ==== | ||
Laden Sie dazu folgenden Code mit TigerJython auf die OxoCard: {{ : | Laden Sie dazu folgenden Code mit TigerJython auf die OxoCard: {{ : |