2022-10-25 07:49:19 +00:00
|
|
|
from telemetrix_rpi_pico import telemetrix_rpi_pico
|
|
|
|
from kuukar_config import COLLISION_DETECTOR_PIN
|
|
|
|
|
|
|
|
from kuukar_lcd import lcd
|
|
|
|
from kuukar_leds import leds
|
2022-10-22 12:39:10 +00:00
|
|
|
class collision:
|
2022-10-25 07:49:19 +00:00
|
|
|
def __init__(self, aux: telemetrix_rpi_pico.TelemetrixRpiPico, lcd: lcd, leds: leds) -> None:
|
|
|
|
self.aux = aux
|
|
|
|
self.lcd = lcd
|
|
|
|
self.leds = leds
|
|
|
|
aux.set_pin_mode_digital_input(COLLISION_DETECTOR_PIN, self.collision_handle)
|
|
|
|
|
|
|
|
def collision_handle(self, data):
|
|
|
|
val = data[2]
|
|
|
|
if val == 1:
|
2022-10-26 08:10:08 +00:00
|
|
|
self.leds.__flasher__(r=255,g=0,b=0,duration=250)
|
|
|
|
self.lcd.play_video("keke_hurt")
|