Difference between revisions of "Push button"

From Sketching with Hardware at LMU Wiki
Jump to navigation Jump to search
(Created page with "= Description = Text Image(s) = How to connect it electrically = Text Image(s) = How to control it in MicroPython = <syntaxhighlight lang="python" line='line'> # todo #...")
 
Line 1: Line 1:
 
= Description =
 
= Description =
Text
+
With this switch we can select which of the two sides are connected to the middle. If we move the switch right then the right pin is connected to the middle. If we move the switch left then the left pin is connected to the middle,
 
 
Image(s)
 
  
 +
[[File:Switch01.PNG|x300px]]
  
 
= How to connect it electrically =
 
= How to connect it electrically =
Text
+
[[File:Switch02.PNG]]
 
 
Image(s)
 
  
 
= How to control it in MicroPython =
 
= How to control it in MicroPython =
 
<syntaxhighlight lang="python" line='line'>
 
<syntaxhighlight lang="python" line='line'>
# todo
+
from machine import Pin
# code goes here
+
in26 = Pin(26, Pin.IN)
 +
print(in26.value())
 
</syntaxhighlight>
 
</syntaxhighlight>
  
= A small Program in MicroPython =
 
<syntaxhighlight lang="python" line='line'>
 
# todo
 
# code goes here
 
</syntaxhighlight>
 
 
text
 
 
image(s)
 
  
 
= Related Tutorial Videos =
 
= Related Tutorial Videos =
change to the right video
+
Digital Input
 
 
<youtube>0KGgYsEZcZM</youtube>
 
 
 
 
 
= Background =
 
text
 
  
image(s)
+
<youtube>va1beT6sxLs</youtube>

Revision as of 22:55, 29 August 2020

Description

With this switch we can select which of the two sides are connected to the middle. If we move the switch right then the right pin is connected to the middle. If we move the switch left then the left pin is connected to the middle,

Switch01.PNG

How to connect it electrically

Switch02.PNG

How to control it in MicroPython

1 from machine import Pin
2 in26 = Pin(26, Pin.IN)
3 print(in26.value())


Related Tutorial Videos

Digital Input