From 2d449f0b617835d885617f911d4429a032dc53ec Mon Sep 17 00:00:00 2001 From: Laborratte5 Date: Fri, 17 May 2024 12:40:28 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20Add=20section=20"Pin=20Zust=C3=A4nde=20?= =?UTF-8?q?einlesen"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add section about reading Pin values - Add schematic and image to explain pull-up/pull-down resistors --- misc/PullUpWiderstand.kicad_sch | 1207 +++++++++++++++++++++++++++++++ src/01_grundlagen.ipynb | 75 ++ src/img/pull-down-resistor.png | Bin 0 -> 9446 bytes 3 files changed, 1282 insertions(+) create mode 100644 misc/PullUpWiderstand.kicad_sch create mode 100644 src/img/pull-down-resistor.png diff --git a/misc/PullUpWiderstand.kicad_sch b/misc/PullUpWiderstand.kicad_sch new file mode 100644 index 0000000..d2e4a6e --- /dev/null +++ b/misc/PullUpWiderstand.kicad_sch @@ -0,0 +1,1207 @@ +(kicad_sch + (version 20231120) + (generator "eeschema") + (generator_version "8.0") + (uuid "010a0f2a-cf19-430b-ad46-7851a0b6c63a") + (paper "A4") + (lib_symbols + (symbol "PCM_Elektuur:S-make" + (pin_numbers hide) + (pin_names + (offset 0) hide) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (property "Reference" "S" + (at 1.27 3.175 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Value" "S-make" + (at 1.27 -3.175 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Footprint" "" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "make/closing contact; switch, single pole, single throw, normally open (SPST-NO/A)" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Sim.Pins" "3=1 3=2 3=3 4=4 4=5 4=6" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Sim.Device" "SPICE" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Sim.Params" "X" + (at 1.27 0 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + (hide yes) + ) + ) + (property "Rating" "V/A" + (at -1.27 -3.175 0) + (effects + (font + (size 1.27 1.27) + ) + (justify right) + (hide yes) + ) + ) + (property "ki_keywords" "S X make closing contact switch single pole throw normally open SPST-NO A" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (symbol "S-make_1_1" + (circle + (center 0 -2.2606) + (radius 0.5334) + (stroke + (width 0.3556) + (type default) + ) + (fill + (type outline) + ) + ) + (polyline + (pts + (xy -2.8956 2.413) (xy -0.381 -2.0574) (xy 0.0254 -1.8288) (xy -2.4892 2.6416) (xy -2.8956 2.413) + ) + (stroke + (width 0.254) + (type default) + ) + (fill + (type outline) + ) + ) + (circle + (center 0 2.2606) + (radius 0.5334) + (stroke + (width 0.3556) + (type default) + ) + (fill + (type none) + ) + ) + (pin passive line + (at 0 -5.08 90) + (length 2.2352) + (name "3" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "3" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin passive line + (at 0 5.08 270) + (length 2.2352) + (name "4" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "4" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + ) + (symbol "S-make_1_2" + (circle + (center 0 -2.032) + (radius 0.5334) + (stroke + (width 0.3556) + (type default) + ) + (fill + (type outline) + ) + ) + (polyline + (pts + (xy -0.3556 -1.8796) (xy 0.0508 -1.651) (xy -2.2352 2.413) (xy -2.6416 2.1844) (xy -0.3556 -1.8796) + ) + (stroke + (width 0.254) + (type default) + ) + (fill + (type outline) + ) + ) + (circle + (center 0 2.032) + (radius 0.5334) + (stroke + (width 0.3556) + (type default) + ) + (fill + (type none) + ) + ) + (pin passive line + (at 0 -5.08 90) + (length 2.4638) + (name "3" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "3" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin passive line + (at 0 5.08 270) + (length 2.4638) + (name "4" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "4" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + ) + (symbol "S-make_1_3" + (circle + (center 0 -2.2606) + (radius 0.5334) + (stroke + (width 0.3556) + (type default) + ) + (fill + (type outline) + ) + ) + (polyline + (pts + (xy -0.3556 -2.1082) (xy 0.0508 -1.8796) (xy -2.2352 2.1844) (xy -2.6416 1.9558) (xy -0.3556 -2.1082) + ) + (stroke + (width 0.254) + (type default) + ) + (fill + (type outline) + ) + ) + (circle + (center 0 2.2606) + (radius 0.5334) + (stroke + (width 0.3556) + (type default) + ) + (fill + (type none) + ) + ) + (pin passive line + (at 0 -5.08 90) + (length 2.2352) + (name "3" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "3" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin passive line + (at 0 5.08 270) + (length 2.2352) + (name "4" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "4" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + ) + ) + (symbol "PCM_Generic:P,+3.3" + (power) + (pin_numbers hide) + (pin_names + (offset 1.27) hide) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (property "Reference" "#PWR" + (at 2.54 0 0) + (effects + (font + (size 2.54 2.54) + ) + (justify left) + (hide yes) + ) + ) + (property "Value" "P,+3.3" + (at 0 2.54 0) + (effects + (font + (size 0.001 0.001) + ) + (justify bottom) + (hide yes) + ) + ) + (property "Footprint" "" + (at 0 0 0) + (effects + (font + (size 2.54 2.54) + ) + (hide yes) + ) + ) + (property "Datasheet" "" + (at 0 0 0) + (effects + (font + (size 2.54 2.54) + ) + (hide yes) + ) + ) + (property "Description" "+3.3 positive potential/voltage (global DC power supply node)" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_keywords" "P V + +3.3 3.3 positive potential voltage tension global DC power supply node label pin equipotential bonding" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (symbol "P,+3.3_1_1" + (polyline + (pts + (xy 0 0) (xy 0 1.8288) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -1.0668 0) (xy 0 1.8288) (xy 1.0668 0) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (text "+3.3" + (at 0 2.54 0) + (effects + (font + (size 2.54 2.54) + ) + (justify bottom) + ) + ) + (pin power_in line + (at 0 0 0) + (length 0) hide + (name "+3.3" + (effects + (font + (size 2.54 2.54) + ) + ) + ) + (number "0" + (effects + (font + (size 0 0) + ) + ) + ) + ) + ) + ) + (symbol "PCM_Generic:P,0" + (power) + (pin_numbers hide) + (pin_names + (offset 3.81) + ) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (property "Reference" "#PWR" + (at 3.81 3.81 0) + (effects + (font + (size 2.54 2.54) + ) + (justify left) + (hide yes) + ) + ) + (property "Value" "P,0" + (at 3.81 0 0) + (effects + (font + (size 0.001 0.001) + ) + (justify left) + (hide yes) + ) + ) + (property "Footprint" "" + (at 0 0 0) + (effects + (font + (size 2.54 2.54) + ) + (hide yes) + ) + ) + (property "Datasheet" "" + (at 0 0 0) + (effects + (font + (size 2.54 2.54) + ) + (hide yes) + ) + ) + (property "Description" "global node 0; simplified functional (equipotential) bonding (FB); simplified frame/chassis" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_keywords" "P V 0 GND FB equipotential bonding earth earthing ground grounding simplified frame chassis potential voltage tension global DC power supply node label pin" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (symbol "P,0_1_1" + (polyline + (pts + (xy -2.54 0) (xy 2.54 0) + ) + (stroke + (width 0.508) + (type default) + ) + (fill + (type none) + ) + ) + (pin power_in line + (at 0 0 0) + (length 0) hide + (name "0" + (effects + (font + (size 2.54 2.54) + ) + ) + ) + (number "0" + (effects + (font + (size 0 0) + ) + ) + ) + ) + ) + ) + (symbol "PCM_SL_Pin_Headers:PINHD_1x1_Male" + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (property "Reference" "J" + (at 0 6.35 0) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Value" "PINHD_1x1_Male" + (at 0 3.81 0) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Footprint" "Connector_PinHeader_2.54mm:PinHeader_1x01_P2.54mm_Vertical" + (at 1.27 -2.54 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "" + (at 0 6.35 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Pin Header male with pin space 2.54mm. Pin Count -1" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_keywords" "Pin Header" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_fp_filters" "Connector_PinHeader_2.54mm:PinHeader_1x01_P2.54mm*" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (symbol "PINHD_1x1_Male_0_1" + (rectangle + (start -1.27 1.27) + (end 1.27 -1.27) + (stroke + (width 0) + (type default) + ) + (fill + (type background) + ) + ) + (polyline + (pts + (xy -1.27 0) (xy 0 0) + ) + (stroke + (width 0.3) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -1.27 0) (xy 0 0) + ) + (stroke + (width 0.5) + (type default) + ) + (fill + (type none) + ) + ) + ) + (symbol "PINHD_1x1_Male_1_1" + (pin passive line + (at -3.81 0 0) + (length 2.54) + (name "" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "1" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + ) + ) + (symbol "PCM_SL_Resistors:Resistor" + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (property "Reference" "R" + (at 0 5.08 0) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Value" "Resistor" + (at 0 2.54 0) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Footprint" "Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal" + (at 0.889 -4.318 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "" + (at 0.508 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "1/4W Resistor" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_keywords" "Resistor" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_fp_filters" "Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm*" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (symbol "Resistor_0_1" + (rectangle + (start -2.286 0.889) + (end 2.286 -0.889) + (stroke + (width 0.24) + (type default) + ) + (fill + (type none) + ) + ) + ) + (symbol "Resistor_1_1" + (pin passive line + (at -3.81 0 0) + (length 1.5) + (name "" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "1" + (effects + (font + (size 0 0) + ) + ) + ) + ) + (pin passive line + (at 3.81 0 180) + (length 1.5) + (name "~" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "2" + (effects + (font + (size 0 0) + ) + ) + ) + ) + ) + ) + ) + (junction + (at 83.82 46.99) + (diameter 0) + (color 0 0 0 0) + (uuid "6fc3c276-6af6-4d31-8c96-132131fe2450") + ) + (wire + (pts + (xy 83.82 60.96) (xy 83.82 63.5) + ) + (stroke + (width 0) + (type default) + ) + (uuid "018b5cca-480f-4695-9664-18e715a6152c") + ) + (wire + (pts + (xy 83.82 46.99) (xy 90.17 46.99) + ) + (stroke + (width 0) + (type default) + ) + (uuid "39da6c99-01a8-4f63-a658-9323f0ba7682") + ) + (wire + (pts + (xy 83.82 41.91) (xy 83.82 46.99) + ) + (stroke + (width 0) + (type default) + ) + (uuid "578682bf-f149-4f84-a6ae-250565547f12") + ) + (wire + (pts + (xy 83.82 46.99) (xy 83.82 50.8) + ) + (stroke + (width 0) + (type default) + ) + (uuid "6249429a-a85e-4da4-aa6d-52d6378bd6f8") + ) + (wire + (pts + (xy 83.82 30.48) (xy 83.82 34.29) + ) + (stroke + (width 0) + (type default) + ) + (uuid "b1168a67-233d-46c1-95fb-70d9c7710013") + ) + (symbol + (lib_id "PCM_Generic:P,+3.3") + (at 83.82 30.48 0) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (fields_autoplaced yes) + (uuid "1e8ec80d-4366-481c-b67c-645043a87f75") + (property "Reference" "#PWR01" + (at 86.36 30.48 0) + (effects + (font + (size 2.54 2.54) + ) + (justify left) + (hide yes) + ) + ) + (property "Value" "P,+3.3" + (at 83.82 27.94 0) + (effects + (font + (size 0.001 0.001) + ) + (justify bottom) + (hide yes) + ) + ) + (property "Footprint" "" + (at 83.82 30.48 0) + (effects + (font + (size 2.54 2.54) + ) + (hide yes) + ) + ) + (property "Datasheet" "" + (at 83.82 30.48 0) + (effects + (font + (size 2.54 2.54) + ) + (hide yes) + ) + ) + (property "Description" "+3.3 positive potential/voltage (global DC power supply node)" + (at 83.82 30.48 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "0" + (uuid "9cf1f902-753b-41eb-87ec-e474068802e2") + ) + (instances + (project "" + (path "/010a0f2a-cf19-430b-ad46-7851a0b6c63a" + (reference "#PWR01") + (unit 1) + ) + ) + ) + ) + (symbol + (lib_id "PCM_SL_Pin_Headers:PINHD_1x1_Male") + (at 93.98 46.99 0) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (fields_autoplaced yes) + (uuid "33835b67-806e-4bf5-b6f5-9e9ff05e6b8c") + (property "Reference" "EingangMikrocontroller" + (at 96.52 46.3549 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Value" "~" + (at 96.52 48.26 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Footprint" "Connector_PinHeader_2.54mm:PinHeader_1x01_P2.54mm_Vertical" + (at 95.25 49.53 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "" + (at 93.98 40.64 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Pin Header male with pin space 2.54mm. Pin Count -1" + (at 93.98 46.99 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "1" + (uuid "994946d0-a1c6-4866-9675-f633cb593bfa") + ) + (instances + (project "" + (path "/010a0f2a-cf19-430b-ad46-7851a0b6c63a" + (reference "EingangMikrocontroller") + (unit 1) + ) + ) + ) + ) + (symbol + (lib_id "PCM_Elektuur:S-make") + (at 83.82 55.88 0) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (fields_autoplaced yes) + (uuid "7944eb49-3d5f-4b4f-a681-ffb843a90dd5") + (property "Reference" "FlashKnopf" + (at 86.36 55.2449 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Value" "~" + (at 86.36 57.15 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Footprint" "" + (at 83.82 55.88 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "" + (at 83.82 55.88 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "make/closing contact; switch, single pole, single throw, normally open (SPST-NO/A)" + (at 83.82 55.88 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Field-1" "X" + (at 85.09 55.88 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + (hide yes) + ) + ) + (property "Rating" "V/A" + (at 82.55 59.055 0) + (effects + (font + (size 1.27 1.27) + ) + (justify right) + (hide yes) + ) + ) + (pin "4" + (uuid "9771e9f2-7155-4bd6-b66d-c889a6675e89") + ) + (pin "3" + (uuid "d88f471e-3124-4b7f-8d07-aab6f6ca8851") + ) + (instances + (project "" + (path "/010a0f2a-cf19-430b-ad46-7851a0b6c63a" + (reference "FlashKnopf") + (unit 1) + ) + ) + ) + ) + (symbol + (lib_id "PCM_Generic:P,0") + (at 83.82 63.5 0) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (fields_autoplaced yes) + (uuid "b38519e5-22f2-4606-8424-ec7218544333") + (property "Reference" "#PWR02" + (at 87.63 59.69 0) + (effects + (font + (size 2.54 2.54) + ) + (justify left) + (hide yes) + ) + ) + (property "Value" "P,0" + (at 87.63 63.5 0) + (effects + (font + (size 0.001 0.001) + ) + (justify left) + (hide yes) + ) + ) + (property "Footprint" "" + (at 83.82 63.5 0) + (effects + (font + (size 2.54 2.54) + ) + (hide yes) + ) + ) + (property "Datasheet" "" + (at 83.82 63.5 0) + (effects + (font + (size 2.54 2.54) + ) + (hide yes) + ) + ) + (property "Description" "global node 0; simplified functional (equipotential) bonding (FB); simplified frame/chassis" + (at 83.82 63.5 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "0" + (uuid "5f05c4d1-5c3a-4e59-896e-c3fabdebd5b1") + ) + (instances + (project "" + (path "/010a0f2a-cf19-430b-ad46-7851a0b6c63a" + (reference "#PWR02") + (unit 1) + ) + ) + ) + ) + (symbol + (lib_id "PCM_SL_Resistors:Resistor") + (at 83.82 38.1 90) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (fields_autoplaced yes) + (uuid "ceabd83b-6185-492b-8664-195069283e9e") + (property "Reference" "PullUpWiderstand" + (at 86.36 37.4649 90) + (effects + (font + (size 1.27 1.27) + ) + (justify right) + ) + ) + (property "Value" "~" + (at 86.36 39.37 90) + (effects + (font + (size 1.27 1.27) + ) + (justify right) + ) + ) + (property "Footprint" "Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal" + (at 88.138 37.211 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "" + (at 83.82 37.592 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "1/4W Resistor" + (at 83.82 38.1 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "2" + (uuid "7a67dbc1-7ba2-4e85-9ba0-83acec6ef7c2") + ) + (pin "1" + (uuid "78538a05-79fb-4d96-8092-83a2edba6db7") + ) + (instances + (project "" + (path "/010a0f2a-cf19-430b-ad46-7851a0b6c63a" + (reference "PullUpWiderstand") + (unit 1) + ) + ) + ) + ) + (sheet_instances + (path "/" + (page "1") + ) + ) +) diff --git a/src/01_grundlagen.ipynb b/src/01_grundlagen.ipynb index 859275d..71b42b1 100644 --- a/src/01_grundlagen.ipynb +++ b/src/01_grundlagen.ipynb @@ -593,6 +593,81 @@ " print(\"x ist größer als 5\")" ] }, + { + "cell_type": "markdown", + "id": "b679354e-d020-4654-894d-38daeaa3a0c4", + "metadata": { + "editable": false, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, + "source": [ + "## Pin Zustände einlesen\n", + "\n", + "Als nächstes wollen wir den Zustand von Pins einlesen und eine entsprechende Meldung ausgeben.\n", + "GPIO 0 ist praktischerweise mit den \"FLASH\" Knopf auf der Platine des Mikrocontrollers verbunden, sodass wir für unseren Test keine extra Schaltung aufbauen müssen.\n", + "Als erstes initialisieren wir den Pin als Input Pin." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "41b849d5-8693-4f31-9496-13a903a3e72c", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "eingabe_pin = machine.Pin(0, machine.Pin.IN, machine.Pin.PULL_UP)\n", + "eingabe_signal = machine.Signal(eingabe_pin, invert=True)" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "id": "245cb3e5-46e4-4fe6-ae54-0df98b41b35f", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, + "source": [ + "Hier übergeben wir noch einen dritten Parameter an die Pin Funktion.\n", + "Dieser dient dazu, die internen Pull-Up Widerstände des Mikrocontrollers für diesen Eingang zu aktivieren.\n", + "Neben `machine.Pin.PULL_UP` gibt es auch noch `machine.Pin.PULL_DOWN`, falls man Pull-Down Widerstände nutzen möchte.\n", + "Pull-Up und Pull-Down Widerstände sind dazu da, bei geöffnetem Schalter ein eindeutiges Signal an den Mikrocontroller so senden. \n", + "![Pull-Down Widerstand Schaltplan](img/pull-down-resistor.png)\n", + "\n", + "Nun können wir mit der `value()` Methode es `eingabe_pin` Objekts den Wert des Pins auslesen bzw. mit der gleichen Methode des `eingabe_signals` den invertierten Eingang.\n", + "Wir invertieren den Pin in diesem Fall, weil der FLASH Knopf den Eingang des Mikrocontrollers mit Ground (dem Minuspol) verbindet, dadurch wird ein Aus-Signal (0) gelesen wenn der Knopf gedrückt ist.\n", + "Genau wie auch bei dem Umkehren der Zustände der LED ist dies auch bei dem einlesen von Pins durch ein `machine.Signal` möglich. \n", + "**Wichtig:** Die nächste Zeile gibt den Zustand des Pins aus zum Zeitpunkt der Ausführung, ihr müsst den Kopf also schon vor der Ausführung drücken, falls ihr den gedrückten Zustand einlesen wollt." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bf1cd20a-a878-449b-8692-527da8ec7800", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "print(eingabe_signal.value())" + ] + }, { "cell_type": "markdown", "id": "f46a9e10-24ff-4d7f-a31b-3a1c5d47df61", diff --git a/src/img/pull-down-resistor.png b/src/img/pull-down-resistor.png new file mode 100644 index 0000000000000000000000000000000000000000..269fc2e04b4fb4009e815a246ec249d02aa9e494 GIT binary patch literal 9446 zcmdUVcT`i$+V=)K9^|T^2m*q1X(~lQiUL9a0RxDX1f(871nIpT1r=#RAShJ`C80z? zT4PXWLJ^Uc5OOFX6a(+%p7XAC*L&A{*S%|fYklAMM`q2Q%$}J&&$FN3Z+_2y zW@@a*$-&0~K@cZQUk46BY*_F^A3g|Lj@aU3A?O?g)46UQltrD0^fRArqOA~}E}7{o zTq&`Dr<^lKapa`?8xQUa8JP5a^l6Y%XkI#$n|GS#@Qfhx)aQN7Vddf9&=yu4yCu3@ z27_c>d2Bg#Ft3_gsQ&#pMN0C>!Sb}$vnTpqE_E}{FI`=8q;0*}q8rUIt-I2kh?hen z8RE;tYdgUkiN*8Y3L+5ni@61v9fG{I_1U0!-T$PpK#WMLv1%rI-`eamNdKFd{0ZnNyJ84 zi)Mr9YkRmXWO~0n3D#z;AUPx&oir6@NSdF(EGHVn9=-P7mKbIj9- zry12>H6qqzoBV0yUnK{Wloys7Xyza5=eeDCioiUD_F?+L*K+FcF#{95*xF@8`Iq6T zWJO+%`Lf31zowIJe}Yn<7~8d$oDj$kaU5O!RZ_nX<Zhmq3|Eu){(U1RIjPmHTpuNA1Se?q$Ab#;=rRx0w=Zfpg)^ zQ3aOe-rc(>Zm|$ra&2&Of$<`uG>>G^fw6}2zQ#9>qh;|^c3(ThgPFSvjF@A;`?0LR zQI1iUsx|bzBPp8HQ6Qa*7v;)00A;j(%0W$BHpsemuhWSG(t5~y2415tnzB0YusAt< zoY`FQ_N}PW$lnL(SxAl(hU$_WbR1`!OYc!1>Y4iAHN@x!k4Y!97lfjT|Tp3J+6e{f;koTu7iGC$Hw)`(C&r+ ztSg%==O+s(oHaK$aUZ|hU(jl=X>pDJ)_iX6C2m~UOQA0}hS{Ny(Y=oFt$?BI=Lq?h zLI+JXTH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