From 04c89df25bfc7eea85aa1d289918a8e491619a88 Mon Sep 17 00:00:00 2001 From: Franziska Gerold Date: Fri, 19 Dec 2025 02:07:57 +1100 Subject: [PATCH] =?UTF-8?q?Pinnummern=20bei=20Rotationssensor=20vertauscht?= =?UTF-8?q?=20um=20Richtung=20zu=20korrigieren,=20Anweisungen=20f=C3=BCr?= =?UTF-8?q?=20Spieler=20einheitlicher=20und=20genauer=20gemacht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bop_it_sensors.py | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/Bop_it_sensors.py b/Bop_it_sensors.py index 4b829a2..c1a6ee4 100644 --- a/Bop_it_sensors.py +++ b/Bop_it_sensors.py @@ -5,14 +5,11 @@ from gpiozero import RotaryEncoder laser = Button(17) #Die Zahl entspricht dem Pin auf dem ARPI600 Board sound = Button(18, pull_up=True) -rotate = RotaryEncoder(21, 20) +rotate = RotaryEncoder(20, 21) tilt = Button(23) -def score(x): - pass - def command_tilt(): - print("waiting to get tilted...") + print("Tilt me!") result = tilt.wait_for_press(timeout=10) print(f"Result: {result}") if result: @@ -24,7 +21,7 @@ def command_tilt(): def command_blind(): - print('waiting for eye problems...') + print('Blind me!') result = laser.wait_for_press(timeout=10) print(f"Result: {result}") if result: @@ -33,7 +30,7 @@ def command_blind(): return -1 def command_scream(): - print('waiting for sound...') + print('Make noise at me!') result = sound.wait_for_press(timeout=10) print(f"Result: {result}") if result: @@ -43,7 +40,7 @@ def command_scream(): return -1 def command_spin_clockwise(): - print("waiting for spinning... clockwise!") + print("Spin me... clockwise!") result = rotate.wait_for_rotate_clockwise(timeout=10) if result: return 1 @@ -51,23 +48,21 @@ def command_spin_clockwise(): return -1 def command_spin_counter_clockwise(): - print("waiting for spinning... counter clockwise!") + print("Spin me... counter clockwise!") result = rotate.wait_for_rotate_counter_clockwise(timeout=10) if result: return 1 else: return -1 - -def sound_was_held(): - print('You screamed long enough!') - def main(): score = 0 result = 0 - sound.when_held = sound_was_held - print("Let's play a Round of 'Raspberry says'!") - list_command_choices =[command_tilt] # [command_spin_clockwise, command_spin_counter_clockwise] #command_spin, command_tilt, command_blind_ command_scream + print("Raspberry will now tell you what to do.") + print("Every correct action will give you a point.") + print("How many can you get?") + print("Let's go!") + list_command_choices =[command_tilt, command_spin_clockwise, command_spin_counter_clockwise, command_blind, command_scream] while result != -1: score += result # war zuerst zwei Zeilen weiter unten, hat dann aber nach einer falschen Runde den Score erhöht time.sleep(0.5)