17 lines
641 B
Python
17 lines
641 B
Python
from telemetrix_rpi_pico import telemetrix_rpi_pico
|
|
from kuukar.kuukar_config import COLLISION_DETECTOR_PIN, COLLISION_ENABLE
|
|
|
|
from kuukar.kuukar_lcd import lcd
|
|
from kuukar.kuukar_leds import leds
|
|
class collision:
|
|
def __init__(self, mcu: telemetrix_rpi_pico.TelemetrixRpiPico, lcd: lcd, leds: leds) -> None:
|
|
self.mcu = mcu
|
|
self.lcd = lcd
|
|
self.leds = leds
|
|
if COLLISION_ENABLE:
|
|
self.mcu.set_pin_mode_digital_input(COLLISION_DETECTOR_PIN, self.collision_handle)
|
|
|
|
def collision_handle(self, data):
|
|
val = data[2]
|
|
if val == 1:
|
|
self.lcd.play_video("keke_hurt") |