Switch: Difference between revisions

From Sketching with Hardware at LMU Wiki
Jump to navigation Jump to search
No edit summary
 
(5 intermediate revisions by one other user not shown)
Line 2: Line 2:
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,  
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,  


[[File:Switch01.PNG]]
[[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)
</syntaxhighlight>
print(in26.value())
 
= A small Program in MicroPython =
<syntaxhighlight lang="python" line='line'>
# todo
# code goes here
</syntaxhighlight>
</syntaxhighlight>


text
image(s)


= Related Tutorial Videos =
= Related Tutorial Videos =
change to the right video
Digital Input
 
<youtube>0KGgYsEZcZM</youtube>
 


= Background =
<youtube>va1beT6sxLs</youtube>
text


image(s)
[[Category:Sensor]]

Latest revision as of 08:50, 11 June 2024

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,

How to connect it electrically

How to control it in MicroPython

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


Related Tutorial Videos

Digital Input