From 5e182838ca0f235c355d856b2b975f887bd51ee5 Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Thu, 30 Mar 2023 15:17:49 +0200 Subject: [PATCH 1/2] add both paths when button A is pressed --- .../Ada_Microbit/examples/MicroBit/jumper/src/main.adb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ASYD_Safety/Ada_Microbit/examples/MicroBit/jumper/src/main.adb b/ASYD_Safety/Ada_Microbit/examples/MicroBit/jumper/src/main.adb index 01b608e..980096b 100644 --- a/ASYD_Safety/Ada_Microbit/examples/MicroBit/jumper/src/main.adb +++ b/ASYD_Safety/Ada_Microbit/examples/MicroBit/jumper/src/main.adb @@ -66,10 +66,12 @@ begin loop if Buttons.State (Button_A) = Pressed then + DO_1_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Up); DO_2_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Up); + DO_3_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Up); DO_4_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Up); Display.Clear; - Display.Display ('0'); + Display.Display ('X'); end if; if Buttons.State (Button_B) = Pressed then DO_1_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Down); @@ -77,7 +79,7 @@ begin DO_3_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Down); DO_4_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Down); Display.Clear; - Display.Display ('X'); + Display.Display ('0'); end if; From de7d8b5f75964e67ec621db2f7d1f88d216d0817 Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Thu, 30 Mar 2023 16:25:19 +0200 Subject: [PATCH 2/2] motor through button active on different paths, no button = inactive --- .../examples/MicroBit/jumper/src/main.adb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ASYD_Safety/Ada_Microbit/examples/MicroBit/jumper/src/main.adb b/ASYD_Safety/Ada_Microbit/examples/MicroBit/jumper/src/main.adb index 980096b..450e94b 100644 --- a/ASYD_Safety/Ada_Microbit/examples/MicroBit/jumper/src/main.adb +++ b/ASYD_Safety/Ada_Microbit/examples/MicroBit/jumper/src/main.adb @@ -64,20 +64,22 @@ begin Display.Clear; loop - + if Buttons.State (Button_A) = Released and Buttons.State (Button_B) = Released and not FreeFallCondition then + DO_1_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Down); + DO_2_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Down); + DO_3_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Down); + DO_4_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Down); + end if; if Buttons.State (Button_A) = Pressed then DO_1_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Up); - DO_2_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Up); DO_3_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Up); - DO_4_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Up); + Display.Clear; Display.Display ('X'); end if; if Buttons.State (Button_B) = Pressed then - DO_1_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Down); - DO_2_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Down); - DO_3_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Down); - DO_4_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Down); + DO_2_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Up); + DO_4_Pt.Set_Pull_Resistor(Pull => HAL.GPIO.Pull_Up); Display.Clear; Display.Display ('0'); end if;