lehrkraefte:blc:informatik:glf20:tasten

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:glf20:tasten [2020/12/07 10:42]
Ivo Blöchliger
lehrkraefte:blc:informatik:glf20:tasten [2020/12/10 08:30] (current)
Ivo Blöchliger
Line 7: Line 7:
 from ivobuttons import * from ivobuttons import *
    
-ivobuttons.delay=0 +ivobuttons.delay=0            # Tasten sofort repetieren 
-ivobuttons.repeat_delay=0+ivobuttons.repeat_delay=0     # Tasten ohne Unterbruch repetieren
    
 while True: while True:
-    s = ivobuttons.states() +    s = ivobuttons.states()   # Zustand der Tasten auslesen 
-    display(str(s), GREEN) +    display(str(s), GREEN)    # Auf dem Display anzeigen 
-    if s==24:  # Beide Knöpfe links (16+8)+    if s==24:                 # Beide Knöpfe links (16+8) -> Programmende
         break         break
 display("OK", RED) display("OK", RED)
 </code> </code>
-Beachten Sie, dass diese Programm nicht ohne Weiteres im Simulationsmodus läuft. Dazu müssen Sie erst noch die [[https://fginfo.ksbg.ch/dokuwiki/doku.php?id=lehrkraefte:blc:informatik:glf20:ivobuttons#verwendung_im_tigerjython_simulator|ivobuttons-Bibliothek für den Simulator]] im gleichen Ordner wie ihr Programm speichern.+Beachten Sie, dass diese Programm nicht ohne Weiteres im Simulationsmodus läuft. Dazu müssen Sie erst noch die Datei {{ :lehrkraefte:blc:informatik:glf19:oxocard:ivobuttons.py |}} (Rechtsklick, speichern unter...) im gleichen Ordner wie ihr Programm speichern. 
 +</WRAP> 
 + 
 +<WRAP todo> 
 +Testen Sie folgendes Programm auf der OxoCard (drücken Sie dazu beliebige Kombinationen der rechten Tasten): 
 +<code python> 
 +from oxocard import * 
 +from ivobuttons import * 
 +  
 +ivobuttons.delay=0            # Tasten sofort repetieren 
 +ivobuttons.repeat_delay=0     # Tasten ohne Unterbruch repetieren 
 +  
 +while True: 
 +    r,g,b = 0,0,0 
 +    s = ivobuttons.states() 
 +    if s & IVO_R1: 
 +        r = 255 
 +    if s & IVO_R2: 
 +        g = 255 
 +    if s & IVO_R3: 
 +        b = 255 
 +    # Schnell zeichnen 
 +    for x in range(2,6): 
 +        for y in range(2,6): 
 +            fastDot(x,y,(r,g,b))     # Zeigt noch nichts an 
 +    fastRepaint()  # Das gezeichnete anzeigen 
 +</code> 
 +  * Was passiert genau beim "Schnell zeichnen"? 
 +  * Setzen Sie die Variablen ''ivobuttons.delay'' und ''ivobuttons.repeat_delay'' auf 800 und 300 und testen Sie das Programm noch einmal. Die Zahlen sind in Millisekunden.  
 +  * Schauen Sie sich das [[https://fginfo.ksbg.ch/dokuwiki/doku.php?id=lehrkraefte:blc:informatik:glf20:ivobuttons#interface|Interface der ivobuttons-Bibliothek]] an. 
 +</WRAP> 
 + 
 +<WRAP todo> 
 +Fahren Sie weiter mit [[lehrkraefte:blc:informatik:glf20:gameloop|dem Game-Loop]]. 
 </WRAP> </WRAP>
  • lehrkraefte/blc/informatik/glf20/tasten.1607334143.txt.gz
  • Last modified: 2020/12/07 10:42
  • by Ivo Blöchliger