示例#1
0
    def __init__(self,
                 arduino=None,
                 android=None,
                 fakeRun=False,
                 fakeMap=None,
                 stepsPerSec=1,
                 **kwargs):
        """ 
        Constructor. Accepts attributes as kwargs.
            
        Args:
            fakeRun: set True if running simulation. Remember to give fake map as input. I.e: fakeMap = fakemap
            fakeMap: set simulation map. If left empty, creates an empty arena.
            pos: a 15x20 array. Contains None, 0 or 1 as values.
            orientation: Centre of 3x3 start area. Default = [1,1]
            map: Map object. Refer to Map.py
            sensors: Sensors object. Refer to sensors.py
            coordinator: Coordinator object. Refer to coordinator.py
        """
        if fakeRun:
            self.fakeRun = True

            from sensors_fake import Sensors
            self.sensors = Sensors(self, fakeMap)  #fake sensors for simulation
            self.coordinator.fakeRun = True
            self.coordinator.stepsPerSec = stepsPerSec
            self.imagefinder = Imagefinder(fakeRun=True)
        elif arduino is None:
            raise Exception("Real run requires arduino to be present")
        elif android is None:
            raise Exception("Real run requires arduino to be present")
        else:
            from sensors import Sensors
            self.android = android
            self.sensors = Sensors(self, arduino)
            self.coordinator.arduino = arduino
            self.imagefinder = Imagefinder()

        #update map
        self.updatemap()
        goalTiles = [  #set goal as explored
            [12, 19],
            [13, 19],
            [14, 19],
            [12, 18],
            [13, 18],
            [14, 18],
            [12, 17],
            [13, 17],
            [14, 17],
        ]
        valuelist = [0] * len(goalTiles)
        self.map.setTiles(goalTiles, valuelist)

        #initialise pathfinder
        self.pathfinder = Pathfinder(self.map)

        #initialise explorer
        self.explorer = Explorer(self)
示例#2
0
def main():
    # Conexão com bd
    connection = DbConnector(
        cnn['host'],
        cnn['port'],
        cnn['database']
    )

    db = connection.connect()
    sensor_db = db.sensores

    # Criando lista de sensores
    sensores_list = [
        Sensors("Sensor 01"),
        Sensors("Sensor 02"),
        Sensors("Sensor 03")
    ]

    # Definição das threads
    thread01 = threading.Thread(
        target=change_temp,
        args=(
            sensores_list[0],
            2,
            sensor_db
        )
    )

    thread02 = threading.Thread(
        target=change_temp,
        args=(
            sensores_list[1],
            2,
            sensor_db
        )
    )

    thread03 = threading.Thread(
        target=change_temp,
        args=(
            sensores_list[2],
            2,
            sensor_db
        )
    )

    # Iniciando threads
    thread01.start()
    thread02.start()
    thread03.start()
示例#3
0
    def __init__(self, gps=False, servo_port=SERVO_PORT):
        # devices
        self._gps = gps
        self.windsensor = WindSensor(I2C(WINDSENSOR_I2C_ADDRESS))
        self.compass = Compass(I2C(COMPASS_I2C_ADDRESS),
                               I2C(ACCELEROMETER_I2C_ADDRESS))
        self.red_led = GpioWriter(17, os)
        self.green_led = GpioWriter(18, os)

        # Navigation
        self.globe = Globe()
        self.timer = Timer()
        self.application_logger = self._rotating_logger(APPLICATION_NAME)
        self.position_logger = self._rotating_logger("position")
        self.exchange = Exchange(self.application_logger)
        self.timeshift = TimeShift(self.exchange, self.timer.time)
        self.event_source = EventSource(self.exchange, self.timer,
                                        self.application_logger,
                                        CONFIG['event source'])

        self.sensors = Sensors(self.gps, self.windsensor, self.compass,
                               self.timer.time, self.exchange,
                               self.position_logger, CONFIG['sensors'])
        self.gps_console_writer = GpsConsoleWriter(self.gps)
        self.rudder_servo = Servo(serial.Serial(servo_port),
                                  RUDDER_SERVO_CHANNEL, RUDDER_MIN_PULSE,
                                  RUDDER_MIN_ANGLE, RUDDER_MAX_PULSE,
                                  RUDDER_MAX_ANGLE)
        self.steerer = Steerer(self.rudder_servo, self.application_logger,
                               CONFIG['steerer'])
        self.helm = Helm(self.exchange, self.sensors, self.steerer,
                         self.application_logger, CONFIG['helm'])
        self.course_steerer = CourseSteerer(self.sensors, self.helm,
                                            self.timer,
                                            CONFIG['course steerer'])
        self.navigator = Navigator(self.sensors, self.globe, self.exchange,
                                   self.application_logger,
                                   CONFIG['navigator'])
        self.self_test = SelfTest(self.red_led, self.green_led, self.timer,
                                  self.rudder_servo, RUDDER_MIN_ANGLE,
                                  RUDDER_MAX_ANGLE)

        # Tracking
        self.tracking_logger = self._rotating_logger("track")
        self.tracking_sensors = Sensors(self.gps, self.windsensor,
                                        self.compass, self.timer.time,
                                        self.exchange, self.tracking_logger,
                                        CONFIG['sensors'])
        self.tracker = Tracker(self.tracking_logger, self.tracking_sensors,
                               self.timer)
示例#4
0
 def test_should_pass_through_wind_drection(self):
     mock_angle = PropertyMock(return_value=10.0)
     windsensor = Mock()
     type(windsensor).angle = mock_angle
     sensors = Sensors(StubGPS(), windsensor, self.compass, self.mock_time,
                       self.exchange, self.logger, DEFAULT_CONFIG)
     self.assertEqual(sensors.wind_direction_relative_instant, 10.0)
示例#5
0
    def __init__(self):
        self.filename = "config.txt"
        with open(self.filename) as f:
            config = f.read()
        self.config_list = [
            y for y in (x.strip() for x in config.splitlines()) if y
        ]
        if self.find("onetouch") == "True":
            self.onetouch = True
        else:
            self.onetouch = False

        self.mysens = Sensors()
        self.mouse = Plattform()
        self.recived_data = None
        self.count = [0, 0, 0, 0, 0]
        self.controlboard = []
        self.oldtouch = [False, False, False, False, False]
        self.touch = [False, False, False, False, False]
        self.sensibility = 0
        self.actived = True

        self.oldx = None
        self.oldy = None
        self.AS = [None, None, None]  #X,Y,Z
        self.AA = [None, None, None]  # X,Y,Z
        self.GS = [None, None, None]  # X,Y,Z
        self.GA = [None, None, None]  # X,Y,Z

        self.mysens.setGyroscopeAngolData(X=0.0, Y=0.0, Z=0.0)
        self.mysens.setGyroscopeScalledData(X=0.0, Y=0.0, Z=0.0)
示例#6
0
 def __init__(self):
     self.w = wheels.wheels()
     self.s = Sensors()
     self.config = configuration.config()
     self.w.setConfig(self.config)
     self.s.setConfig(self.config)
     self.s.calibration = True
示例#7
0
    def main_loop(self):
        while (self.game.count <= self.game.max_games):
            #reseting game
            self.game.reset()

            self.init_distance()

            self.sensors = Sensors(self.game.grid, self.game.player)

            # game loop
            while self.game.player.alive:

                # give input to game
                action = self.generate_action()
                #action = 0
                self.game.step(self.sensors, action)

                # get observation
                observation = [
                    self.sensors.obstacle_forward(),
                    self.sensors.obstacle_left(),
                    self.sensors.obstacle_right(),
                    self.get_food_distance(),
                    self.get_reward(), action
                ]
                #training_data.append(observation)
                ##ANN
                artificial_neural_network.train(observation)

                # print("forward ", "    left ", "    right ", "    food ",  "    action ", "   reward ")
                # print(observation)
                #print(training_data)

            #end of game loop
            self.game.count = self.game.count + 1
示例#8
0
def main():
    for i in range(len(sys.argv)):
        if sys.argv[i] == '-t':
            if len(sys.argv) < i + 3:
                print 'device and baud needed for option -t'
                exit(1)
            test(sys.argv[i + 1], int(sys.argv[i + 2]))

    print 'Servo Server'
    server = SignalKServer()

    from sensors import Sensors
    sensors = Sensors(server)
    servo = Servo(server, sensors)
    servo.max_current.set(10)

    period = .1
    start = lastt = time.time()
    while True:
        servo.poll()
        sensors.poll()

        if servo.controller.value != 'none':
            print 'voltage:', servo.voltage.value, 'current', servo.current.value, 'ctrl temp', servo.controller_temp.value, 'motor temp', servo.motor_temp.value, 'rudder pos', sensors.rudder.angle.value, 'flags', servo.flags.strvalue(
            )
            #print servo.command.value, servo.speed.value, servo.windup
            pass
        server.HandleRequests()

        dt = period - time.time() + lastt
        if dt > 0 and dt < period:
            time.sleep(dt)
            lastt += period
        else:
            lastt = time.time()
    def __init__(self):
        self.drive = new Nomad()
        self.oi = new OI()
        self.ds = DriverStation.getInstance()

        self.infont = NetworkTables.getTable('info')
        self.sensors = new Sensors()
示例#10
0
	def __init__(self):
		super(Main, self).__init__()
		## initialize sensors
		self.sensorThread = False
		self.radioThread = False
		self.cameraThread = False
		try:
			self.sensorThread = Sensors()
		except:
			print("error initing sensor thread")
		try:
			pass
			#self.cameraThread = Camera('Mini')
		except:
			print("error initializing camera thread")
		try:
			self.radioThread = Radio(self)
		except:
			print("error initing radio thread")
		#self.numberGen = RandomThread()
		self.daemon = True
		self.fileLocation = str(os.getcwd()) + '/'
		self.data_file = self.fileLocation + str(datetime.now().replace(microsecond=0))
		print("initialized")
		print(self.data_file)
def __init__():

    sensors = None  # type: Sensors

    while True:

        print("""
        [1] Sensors - Create/Recreate
        [2] Sensors - Apply Configuration
        [3] Sensors - Reset Configuration
        [4] Sensors - Calibrate
        [5] Sampling - Start
        [6] Sampling - Stop
        [7] Sampling - View Current
        [0] Exit
        """)

        option = input("Choice: ")

        if option == "0":

            if not (sensors is None) and sensors.running:
                sensors.stop()

            print("Exiting")
            break

        elif option == "1":
            sensors = Sensors()
            print("Sensors created")

        elif sensors is None:
            print("Not created sensors")

        elif option == "2":
            sensors.configure()
            print("Configuration applied to sensors")

        elif option == "3":
            sensors.reset()
            print("Sensor configurations reseted")

        elif option == "4":
            sensors.calibrate()
            print("Calibrated sensors")

        elif option == "5":
            sensors.start()
            print("Sampling started")

        elif option == "6":
            sensors.stop()
            print("Sampling stoped")

        elif option == "7":
            sensors.showCurrent()

        else:
            print("Invalid Choice.")
示例#12
0
 def __init__(self, car):
     self.sensors = Sensors()
     self.references = [-1, -1, -1, -1, -1]
     self.car = car
     if not self.is_calibrated():
         self.calibration()
     else:
         self.load_calibration()
示例#13
0
 def __init__(self):
     config = configparser.ConfigParser()
     config_file = os.path.join(os.path.dirname(__file__), 'config.ini')
     config.read(config_file)
     client = InfluxDBClient.from_config_file(config_file)
     self.write_api = client.write_api()
     self.bucket = config['ha']['influx_bucket']
     self.sensors = Sensors()
示例#14
0
 def setup(self):
     self.timer = Timer()
     self.utils = Utils(time.time(), 180)  #start time, total game time
     self.sensors = Sensors(self.tamp)
     self.actuators = Actuators(self.tamp)
     self.motorController = MotorController(self.sensors, self.actuators)
     self.myState = startState(self.sensors, self.actuators,
                               self.motorController, self.timer, self.utils)
示例#15
0
    def setup(self):
        self.logger.info("--------------------------------------")
        self.logger.info("   Balloon Mission Computer V4.01     ")
        self.logger.info("--------------------------------------")
        self.logger.debug("setup")
        # setup
        with open('data/config.json') as fin:
            self.config = json.load(fin)
        self.images_dir = self.config["directories"][
            "images"] if "directories" in self.config and "images" in self.config[
                "directories"] else "./images"
        self.tmp_dir = self.config["directories"][
            "tmp"] if "directories" in self.config and "tmp" in self.config[
                "directories"] else "./tmp"

        if not os.path.exists(self.tmp_dir):
            os.makedirs(self.tmp_dir)
        if not os.path.exists(self.images_dir):
            os.makedirs(self.images_dir)

        GPIO.setwarnings(False)
        GPIO.setmode(GPIO.BCM)  # Broadcom pin-numbering scheme
        GPIO.setup(self.config['pins']['BUZZER'], GPIO.OUT)
        GPIO.setup(self.config['pins']['LED1'], GPIO.OUT)
        GPIO.setup(self.config['pins']['LED2'], GPIO.OUT)
        GPIO.output(self.config['pins']['LED1'], GPIO.HIGH)

        self.aprs = APRS(self.config['callsign'], self.config['ssid'],
                         "idoroseman.com")
        self.modem = AFSK()
        self.gps = Ublox()
        self.gps.start()
        self.radio = Dorji(self.config['pins'])
        self.radio.init()
        self.radio_q = queue.Queue()
        self.radio_thread = threading.Thread(target=self.radio_worker)
        self.radio_thread.start()
        self.timers = Timers(self.config['timers'])
        self.sensors = Sensors()
        self.cam = Camera()
        self.ssdv = SSDV(self.config['callsign'], self.config['ssid'])
        self.sstv = SSTV()
        self.webserver = WebServer()
        self.radio_queue(self.config['frequencies']['APRS'],
                         'data/boatswain_whistle.wav')

        for item in ["APRS", "APRS-META", "Imaging", 'Capture']:
            self.timers.handle({item: self.config['timers'][item] > 0}, [])
        self.timers.handle({"Buzzer": False}, [])

        self.ledState = 1
        self.imaging_counter = 1
        self.state = "init"
        self.min_alt = sys.maxsize
        self.max_alt = 0
        self.prev_alt = 0
        self.send_bulltin()
        GPIO.output(self.config['pins']['LED1'], GPIO.LOW)
示例#16
0
 def __init__(self, url, flightname, device_id=None, jwt_token=None):
     self.url = '{}/flight/{}/telemetry?authorization={}'.format(
         url, flightname, jwt_token)
     self.timeout_seconds = 10
     self.coords = []
     self.imei = device_id
     self.momsn = None
     self.import_coordinates_list()
     self.sensors = Sensors(self.coords)
示例#17
0
def main():
    '''
        Main Function of the program
    '''
    #print("Scarecrow starting...")
    #print("Loading Sensors")
    source = Sensors()
    sigfox = SerialConnection()
    time.sleep(0.1)
    print("Loading AIModel")
    img_handler = ImgProcessing(camera=0, debug=False)
    print("AI Model loaded")
    while (True):
        try:
            sigfox.open_conn()
            data = source.get_temp_n_hum()
            temperature = data[0]
            humidity = data[1]
            luminosity = source.get_lum()
            if luminosity >= 20000:
                luminosity = 0
            elif luminosity >= 10000:
                luminosity = 1
            elif luminosity >= 5000:
                luminosity = 2
            else:
                luminosity = 3
            rain = source.get_rain()
            if rain >= 5000:
                rain = 1
            else:
                rain = 0
            soil = source.get_soil()
            if soil >= 20000:
                soil = 0
            elif soil >= 17000:
                soil = 1
            elif soil >= 100:
                soil = 2
            bugs = img_handler.process_image(source)
            print(bugs)
            data = [
                int(temperature),
                int(humidity), 100, luminosity, bugs, rain, soil
            ]
            print(data)
            send_message(data, sigfox)
            sigfox.close_conn()
            source.blueLed()
            img_handler.capture.release()
        except KeyboardInterrupt:
            print("flw")
            GPIO.cleanup()

        time.sleep(5)

    GPIO.cleanup()
示例#18
0
def sensor_function(sensor_bus, delay):
	'''
	create a sensor class, read the sensor values and write them in a loop
	:param: sensor_bus 
	:param: timer delay
	'''
	sensor = Sensors()
	lock = Lock()
	while True:
		with lock
 def testCalculator_adds_and_gets_data(self):
     sensors = Sensors()
     data = sensors.poll()
     calculator = server.Calculator()
     calculator.add_datum(data)
     self.assertIn(
         "PEEP",
         calculator.get_datum()["patient-0"],
         "Fails to add data to and then get data from "
         "the calculator.")
示例#20
0
 def __initVars(self):
     """Subscribers vars initialisation"""
     self.sensors = Sensors()
     self.trans_listener = tf.TransformListener()
     self.sensors.add("trans", None)
     self.old_trans = None
     self.sensors.add("rot", None)
     self.rate_pub_enabled = False
     self.messager = mav_msgs.RateThrust()
     self.collision = False
def run_sensors(gapps, user_options):
    """
    Utility method to publish to the gridappsdmock instead of going through
    the gridappsd service process.

    :param gapps:
    :param user_options:
    """
    sensors = Sensors(gapps, "read", "write", user_options)
    for data in next_line():
        sensors.on_simulation_message({}, deepcopy(data))
示例#22
0
 def initialize_threads(self):
     """ Initializes io threads"""
     super().initialize_threads()
     self.dashboard_interval = int(self.ping_interval * 2)
     self.topic_fastclock_pub = self.publish_topics[Global.FASTCLOCK]
     self.topic_dashboard_pub = self.publish_topics[Global.DASHBOARD]
     self.topic_node_pub = self.publish_topics[Global.NODE]
     self.topic_ping_sub = self.subscribed_topics[Global.PING]
     # print("!!! ping sub: "+self.topic_ping_sub)
     self.topic_sensor_sub = self.subscribed_topics[Global.SENSOR]
     self.topic_backup_sub = self.subscribed_topics[Global.BACKUP]
     # print("!!! backup sub: "+self.topic_backup_sub)
     if Global.CONFIG in self.config:
         if Global.OPTIONS in self.config[Global.CONFIG]:
             if Global.TIME in self.config[Global.CONFIG][Global.OPTIONS]:
                 if Global.FAST in self.config[Global.CONFIG][
                         Global.OPTIONS][Global.TIME]:
                     if Global.RATIO in self.config[Global.CONFIG][
                             Global.OPTIONS][Global.TIME][Global.FAST]:
                         self.fast_ratio = int(
                             self.config[Global.CONFIG][Global.OPTIONS][
                                 Global.TIME][Global.FAST][Global.RATIO])
                     if Global.INTERVAL in self.config[Global.CONFIG][
                             Global.OPTIONS][Global.TIME][Global.FAST]:
                         self.fast_interval = int(
                             self.config[Global.CONFIG][Global.OPTIONS][
                                 Global.TIME][Global.FAST][Global.INTERVAL])
             if Global.PING in self.config[Global.CONFIG][Global.OPTIONS]:
                 self.ping_interval = self.config[Global.CONFIG][
                     Global.OPTIONS][Global.PING]
             if Global.BACKUP in self.config[Global.CONFIG][Global.OPTIONS]:
                 self.backup_path = self.config[Global.CONFIG][
                     Global.OPTIONS][Global.BACKUP]
     self.roster = Roster(self.log_queue,
                          file_path=Global.DATA + "/" + Global.ROSTER +
                          ".json")
     self.switches = Switches(self.log_queue,
                              file_path=Global.DATA + "/" +
                              Global.SWITCHES + ".json")
     self.warrants = Warrants(self.log_queue,
                              file_path=Global.DATA + "/" +
                              Global.WARRANTS + ".json")
     self.signals = Signals(self.log_queue,
                            file_path=Global.DATA + "/" + Global.SIGNALS +
                            ".json")
     self.layout = Layout(self.log_queue,
                          file_path=Global.DATA + "/" + Global.LAYOUT +
                          ".json")
     self.dashboard = Dashboard(self.log_queue,
                                file_path=Global.DATA + "/" +
                                Global.DASHBOARD + ".json")
     self.sensors = Sensors(self.log_queue,
                            file_path=Global.DATA + "/" + Global.SENSORS +
                            ".json")
示例#23
0
 def __init__(self, x=0, y=0, theta=0):
     self.x = x
     self.y = y
     self.theta = radians(theta)
     self.velLin = 0
     self.velAng = 0
     self.distFront = 0
     self.distRight = 0
     self.distLeft = 0
     self.sensors = Sensors()
     self.control = False
示例#24
0
 def test_should_return_wind_relative_average_after_several_update_averages_events(
         self):
     mock_angle = PropertyMock(side_effect=[10.0, 20.0])
     windsensor = Mock()
     type(windsensor).angle = mock_angle
     sensors = Sensors(StubGPS(), windsensor, self.compass, self.mock_time,
                       self.exchange, self.logger, DEFAULT_CONFIG)
     self.exchange.publish(Event(EventName.update_averages))
     self.exchange.publish(Event(EventName.update_averages))
     self.assertEqual(sensors.wind_direction_relative_average,
                      round(((0.0 + 10) / 2 + 20) / 2), 0)
示例#25
0
    def test_should_register_logging_according_to_config(self):
        self.listen(EventName.every)
        config = DEFAULT_CONFIG
        config['log interval'] = 15

        sensors = Sensors(self.gps, self.windsensor, self.compass,
                          self.mock_time, self.exchange, self.logger, config)

        every_event = self.events[EventName.every][0]
        self.assertEqual(every_event.seconds, 15)
        self.assertEqual(every_event.next_event.name, EventName.log_position)
示例#26
0
 def test_should_provide_a_rounded_average_for_values_either_side_of_zero(
         self):
     mock_angle = PropertyMock(side_effect=[350.0, 0.0, 10.0])
     windsensor = Mock()
     type(windsensor).angle = mock_angle
     sensors = Sensors(StubGPS(), windsensor, self.compass, self.mock_time,
                       self.exchange, self.logger, DEFAULT_CONFIG)
     self.exchange.publish(Event(EventName.update_averages))
     self.exchange.publish(Event(EventName.update_averages))
     self.exchange.publish(Event(EventName.update_averages))
     self.assertEqual(sensors.wind_direction_relative_average, 4.0)
    def main(self):
        start_time = time.time()
        cpu_usage = psutil.cpu_percent()

        if getattr(sys, 'frozen', False):
            configFile = Path(os.path.dirname(sys.executable) + "/config.yaml")
        else:
            configFile = Path(
                os.path.dirname(os.path.abspath(__file__)) + "/config.yaml")
        with open(str(configFile), 'r') as stream:
            try:
                config = yaml.load(stream)
            except yaml.YAMLError as exc:
                print(exc)

        self.URL = "http://" + str(config['server']['host']) + ":" + str(
            config['server']['port'])
        self.apikey = self.getApiKey()
        textStorage = TextStorage(self.URL)
        sensors = Sensors()
        sensors.initializeSensors()

        # Continuously loop
        while True:
            # Construct our weatherdata json object
            cpu_usage = psutil.cpu_percent()
            ram = psutil.virtual_memory()
            ram_usage = ram.percent
            weatherdata = sensors.getSensorData(self.apikey, cpu_usage,
                                                ram_usage)

            #Previous semester Posting Method
            #time.sleep(4)
            #try:
            #r = requests.post(self.URL + '/api/weather', data = serv1)
            #if (r.status_code == 200):
            #  textStorage.sendWeather()
            # print("Sent: " + json.dumps(serv1))
            # elif (r.status_code == 400):
            #  print("Invalid API key")
            # Exception if unable to connect to server for the post request
            #except (requests.exceptions.ConnectionError):
            #print("Lost connection to server...storing data locally.")
            # textStorage.storeWeather(serv1)
            #  pass

            #The above commented code is the way previous semester posted to the server. We no longer need that because each individual Pi will not be posting anymore, and only Master will post.
            #Because of that, each Pi needs to store their data locally and broadcast via LoRa to Master.
            print("Lost connection to server...storing data locally.")
            textStorage.storeWeather(weatherdata)

            # Wait 3 seconds before restarting the loop
            time.sleep(self.WAIT_TIME)
示例#28
0
 def __init__(self, safety_level=0):
     Motion.__init__(self)
     self._logger = Logger("SafeMotion")
     
     # set up sensor module
     self.sensors = Sensors()
     
     # set avoidance state
     self.avoiding = False
 
     # set motion modification based on safety level
     self._motionModifier = self._avoid if safety_level > 0 else self._safetyStop
 def __init__(self):
     pygame.init()
     pygame.display.set_caption("AI Car game")
     width = 1200
     height = 900
     self.screen = pygame.display.set_mode((width, height))
     self.clock = pygame.time.Clock()
     self.pad_group = pygame.sprite.RenderPlain(*pads2)
     self.car = CarSprite('images/car.png', (100, 730))
     self.sensors = Sensors(self.car.position, self.car.direction, self.pad_group)
     self.ticks = 60
     self.font = pygame.font.Font(None, 75)
     self.exit = False
示例#30
0
def main():
    GPIO.setmode(GPIO.BOARD)  #refference by pin number
    GPIO.setwarnings(False)
    #test_left_engine()
    #test_right_engine()
    #test_pwm()
    sensors = Sensors()
    while True:
        print(sensors.check_sensors_state())
        sleep(0.5)
        pass

    GPIO.cleanup()