コード例 #1
0
ファイル: gui.py プロジェクト: TheoT/haptic
from hellousb import *
from Tkinter import *
import time
usb=hellousb()
usb.set_vals(0,0)
usb.print_vals()

usb.test_forward_go()
for i in range(50):
	usb.print_current()
	time.sleep(.3)
	# usb.reverse_direction()
usb.test_stop()
usb.print_vals()
コード例 #2
0
ファイル: pan-tiltGUI.py プロジェクト: stevew817/elecanisms
from hellousb import *
import time
from time import sleep
from threading import Thread

from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.ticker import LinearLocator
import matplotlib.pyplot as plt
import numpy as np


root = Tk()
root.title("Pan-tilt GUI")

pic = hellousb()				#initializes USB peripheral

pan = IntVar()
tilt = IntVar()
d_range = 180					#range of degrees to display with slider
k = 65535/d_range				#maps angle to 16-bit servo position

mapsize = 40					#amount of rows/cols in the depthmap
Depthmap = [[0 for i in range(mapsize)] for j in range(mapsize)]

def move_servo(a):
	''' Callback for sliders'''
	A = pan.get()			
	B = tilt.get()
	pic.set_vals(k*A,k*B)		#vendor request
コード例 #3
0
from hellousb import *
pic = hellousb()

while True:
	print(pic.get_vals())