ME 405 Romi
Loading...
Searching...
No Matches
bump__sensor.py
Go to the documentation of this file.
1
from
pyb
import
Pin, Timer, ADC
2
10
class
Bump_Sensor
:
11
15
def
__init__
(self, p1,p2,p3):
16
17
self.
Pin_A
=Pin(p1,mode=Pin.IN, pull=Pin.PULL_UP)
18
self.
Pin_B
=Pin(p2,mode=Pin.IN, pull=Pin.PULL_UP)
19
self.
Pin_C
=Pin(p3,mode=Pin.IN, pull=Pin.PULL_UP)
20
21
26
def
is_pressed
(self):
27
# print(f"PinA {self.Pin_A.value()}, pinb {self.Pin_B.value()}, pinc {self.Pin_A.value()}")
28
if
0
in
(self.
Pin_A
.value(), self.
Pin_B
.value(), self.
Pin_C
.value()):
29
return
True
30
else
:
31
return
False
32
33
34
bump__sensor.Bump_Sensor
Initializes Bump sensors.
Definition
bump__sensor.py:10
bump__sensor.Bump_Sensor.__init__
__init__(self, p1, p2, p3)
This initializes the Pins to input pins and enables internal pull-ups for one set of bump sensors (th...
Definition
bump__sensor.py:15
bump__sensor.Bump_Sensor.is_pressed
is_pressed(self)
This function tests if any one of three sensors has been pressed.
Definition
bump__sensor.py:26
bump__sensor.Bump_Sensor.Pin_C
Pin_C
Definition
bump__sensor.py:19
bump__sensor.Bump_Sensor.Pin_B
Pin_B
Definition
bump__sensor.py:18
bump__sensor.Bump_Sensor.Pin_A
Pin_A
Definition
bump__sensor.py:17
vscode_python
bump__sensor.py
Generated by
1.15.0