Commit 95f5fce1 authored by Phyks's avatar Phyks
Browse files

Add the ability to change default serial port from command line in

parent 1c15c86c
......@@ -2,6 +2,8 @@
import serial
import pygame
import sys
import getopt
def compute_value(line, minimum, maximum):
......@@ -23,7 +25,27 @@ def compute_value(line, minimum, maximum):
return value
ser = serial.Serial("/dev/ttyACM0", 115200)
serial_port = "/dev/ttyACM0"
opts, args = getopt.getopt(sys.argv[1:], "hs:",["help", "serial="])
for opt, arg in opts:
if opt == "-h" or opt == "-help":
print("Touchless 3D tracking with color mapping")
print("\nUsage : "+sys.argv[0]+" [OPTIONS]")
print("\nTrack the position of your hand in 3D and map it in RGB space")
print("\nOptions :")
print("\t-h (--help) \t display this help message")
print("\t-s (--serial) \t change serial port (default is "+
elif opt in ("-s", "--serial"):
serial_port = arg
except getopt.GetoptError:
ser = serial.Serial(serial_port, 115200)
# Keep old value to determine a mean value
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment