Пример #1
0
    arduino_port = os.getenv('ARDUINO_PORT')

    # Initialize the Arduino connection
    arduino = Arduino(arduino_port)
    arduino.connect()

    # Initialize the camera streams
    camera_stream_settings = [
        ('/dev/video0', (1280, 720), 30),
        ('/dev/video1', (1280, 720), 30),
        ('/dev/video2', (640, 480), 30)
    ]
    camera_streams = [CameraStream(settings[0], settings[1], settings[2], host, gst_port)
                      for settings in camera_stream_settings]

    # Set the camera streams to PAUSED so that they are ready to send video
    for stream in camera_streams:
        stream.set_paused()

    # Create the client
    client = Client(host, port, arduino, camera_streams)

    # Set the first camera stream to PLAYING
    camera_streams[0].set_playing()
    client.active_camera_stream = camera_streams[0]

    # Run the client
    while True:
        client.connect_and_run()
        sleep(client.RECONNECT_DELAY)