change board for ultrasonic distance sensor

This commit is contained in:
Siwat Sirichai 2022-12-06 13:39:39 +07:00
parent e61e0b36dd
commit ede5d70bce
2 changed files with 6 additions and 5 deletions

View File

@ -11,7 +11,7 @@ class kuukar:
def __init__(self) -> None:
self.mcu = telemetrix_rpi_pico.TelemetrixRpiPico(com_port=SERIAL_MCU, sleep_tune=0.001)
self.drv = telemetrix_rpi_pico.TelemetrixRpiPico(com_port=SERIAL_DRV, sleep_tune=0.001)
self.sensors = kuukar_sensors.sensors(self.mcu)
self.sensors = kuukar_sensors.sensors(self.mcu, self.drv)
self.leds = kuukar_leds.leds(self.mcu)
self.motion = kuukar_motion.motion(self.mcu, self.drv, self.leds, self.sensors)
self.lcd = kuukar_lcd.lcd(self.motion, self.sensors)

View File

@ -12,11 +12,12 @@ class sensors:
__humidity = 0
__brightness = 0
def __init__(self, mcu: telemetrix_rpi_pico.TelemetrixRpiPico) -> None:
def __init__(self, mcu: telemetrix_rpi_pico.TelemetrixRpiPico, drv: telemetrix_rpi_pico.TelemetrixRpiPico) -> None:
self.mcu = mcu
self.mcu.set_pin_mode_analog_input(SONAR_1_ADC_PIN, 10, self.__sonar_callback)
self.mcu.set_pin_mode_analog_input(SONAR_2_ADC_PIN, 10, self.__sonar_callback)
self.mcu.set_pin_mode_analog_input(SONAR_3_ADC_PIN, 10, self.__sonar_callback)
self.drv = mrv
self.drv.set_pin_mode_analog_input(SONAR_1_ADC_PIN, 10, self.__sonar_callback)
self.drv.set_pin_mode_analog_input(SONAR_2_ADC_PIN, 10, self.__sonar_callback)
self.drv.set_pin_mode_analog_input(SONAR_3_ADC_PIN, 10, self.__sonar_callback)
self.mcu.set_pin_mode_dht(DHT22_PIN, self.__dht22_callback)
self.mcu.set_pin_mode_analog_input(LIGHT_ANALOG_PIN, 0, self.__light_sensor_callback)