Пример #1
0
    def run(self):
        i = 0
        while True:
            check_dns, message = check_dns_resolution(REMOTE_SERVER_NAME)
            logger.info(message)
            check_connection, message = is_connected(REMOTE_SERVER_IP)
            logger.info(message)

            if not check_connection and self.restart:
                logger.warning("reset connection")
                message = reset(self.url, self.password)
                logger.info(message)
            else:
                logger.info("Connection working")
            time.sleep(300)
Пример #2
0
from time import sleep
import library as car

car.offsensor()
try:
    while True:
        car.motor(999, 999)
        sleep(1)
        car.stop()
        sleep(1)

        car.motor(-999, -999)
        sleep(1)
        car.stop()
        sleep(1)

        # car.motor(0, -999)
        # sleep(1)
        # car.stop()
        # sleep(0.2)

        # car.motor(999, 0)
        # sleep(1)
        # car.stop()
        # sleep(0.2)
finally:
    car.reset()
Пример #3
0
import colorsys
from time import sleep
import library as a
try:
    while True:
        for i in range(0, 360, 5):
            x = list(colorsys.hsv_to_rgb(i / 360, 1, 0.2))
            for j in range(len(x)):
                x[j] = int(x[j] * 255)
            a.led(*x)
            sleep(0.01)
finally:
    a.reset()