Exemplo n.º 1
0
	def connectDevices():

		try: Arduino.disconnect()
		except: pass
		Arduino.connect('/dev/%s' % app.getArdPort(), 250000)

		try:
			EntTec.disconnect()
		except: pass
		EntTec.connect('/dev/%s' % app.getEntPort()) #'/dev/tty.usbserial-EN172718'

		app.drawConnect()
Exemplo n.º 2
0
	def drawConnect(self):
		"Draw the connect settings"

		# Get ports (exclude bluetooth ports)
		ports = [port for port in os.listdir('/dev/') if port[:4] == 'tty.' and port[:8] != 'tty.Blue' ]

		ArduinoPort = ''
		for port in ports:
			if port[:12] == 'tty.usbmodem':
				ArduinoPort = port

		"""Connection status render"""
		self.arduinoSelect = StringVar(self.cnctFrame)
		self.arduinoSelect.set(ArduinoPort)
		PortSelectOut = OptionMenu(self.cnctFrame, self.arduinoSelect,*ports)
		PortSelectOut.grid(row=14, columnspan=2, column=0)
		Label(self.cnctFrame, text="Status: %s" % Arduino.isConnectedString() , **styleKwargs).grid(row=15, columnspan=2, column=0)

		self.EntSelect = StringVar(self.cnctFrame)
		self.EntSelect.set('tty.usbserial-EN172718')
		PortSelectOut = OptionMenu(self.cnctFrame, self.EntSelect,*ports)
		PortSelectOut.grid(row=16, columnspan=2, column=0)
		Label(self.cnctFrame, text="Status: %s" % EntTec.isConnectedString() , **styleKwargs).grid(row=17, columnspan=2, column=0)

		#Label(self.cnctFrame, text="IP", **styleKwargs).grid(row=18, columnspan=1, column=0)
		#IPadd = Entry(self.cnctFrame, width=5, **styleKwargs).grid(row=19, columnspan=2, column=0)
		#Label(self.cnctFrame, text="Port", **styleKwargs).grid(row=20, columnspan=1, column=0)
		#portadd = Entry(self.cnctFrame, width=4, **styleKwargs).grid(row=21, columnspan=2, column=0)


		connectButton = Button(self.cnctFrame, text="Reload Connections", command=connectDevices, **styleKwargs)
		connectButton.grid(row=30, columnspan=2, column=0)

		self.cnctFrame.grid(row=1,column=2, padx=50)