ME 405 Romi
Loading...
Searching...
No Matches
bump__sensor.py
Go to the documentation of this file.
1from pyb import Pin, Timer, ADC
2
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
Initializes Bump sensors.
__init__(self, p1, p2, p3)
This initializes the Pins to input pins and enables internal pull-ups for one set of bump sensors (th...
is_pressed(self)
This function tests if any one of three sensors has been pressed.