lehrkraefte:blc:informatik:glf19:oxocard:oxohack

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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]::getportnames() [System.IO.Ports.SerialPort]::getportnames()
 +Write-Host -NoNewLine 'Press any key to continue...';
 +$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
 </code> </code>
  
-==== Gerät "ESP32" und COM-Port setzen ==== +==== In TigerJython Gerät "ESP32" und COM-Port setzen ==== 
-Im Menü Datei -> Einstellungen -> Bibliotheken den Punkt "ESP32" auswählen und den COM-Port eintragen (z.B. COM4).+In TigerJython, im Menü (oben links) wählen Sie Datei -> Einstellungen -> Bibliotheken und dann unten den Punkt "ESP32" auswählen und den COM-Port eintragen (z.B. COM4).
  
 ==== Beispiel-Code ==== ==== Beispiel-Code ====
 <code python oxohack.py> <code python oxohack.py>
-#Initialisierung der Oxocard +# 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 +    from machine import Pin, deepsleep, ADC, reset 
-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, 0xffff00, update = True)
 +    # 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("Power off")
 +            for k in [250, 100, 50, 20, 10, 5, 1, 0]:
 +                for i in range(8):
 +                    __np.set(9*i+1, k << 16, update = False)
 +                    __np.set(7*i+8, k << 16, update = False)
 +                __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("Hello Hack!", BLUE) bigTextScroll("Hello Hack!", BLUE)
- 
- 
- 
- 
- 
- 
- 
- 
-################################################# 
-# 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, i), k << 16, update = False) 
-        __np.set(_toPix(7 - i, i), k << 16, update = False) 
-   __np.show() 
-   time.sleep(0.5) 
-Pin(2, Pin.OUT).value(0) # audio ampli off 
-Pin(15, Pin.OUT).value(1) # neopix off 
-deepsleep() 
- 
- 
 </code> </code>
  
 ==== OxoCard wieder in Originalzustand setzen ==== ==== OxoCard wieder in Originalzustand setzen ====
 Laden Sie dazu folgenden Code mit TigerJython auf die OxoCard: {{ :lehrkraefte:blc:informatik:glf19:oxocard:mainorig.py |}} Laden Sie dazu folgenden Code mit TigerJython auf die OxoCard: {{ :lehrkraefte:blc:informatik:glf19:oxocard:mainorig.py |}}
  • lehrkraefte/blc/informatik/glf19/oxocard/oxohack.1572553431.txt.gz
  • Last modified: 2019/10/31 21:23
  • by Ivo Blöchliger