Update
Updated code and Tutorial.pdf
This commit is contained in:
parent
ee8fca1e23
commit
f14021b98a
@ -1,30 +1,16 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Form implementation generated from reading ui file 'F:/GUO/test/qss/Client_Ui.ui'
|
# Form implementation generated from reading ui file 'C:\Users\Freenove\Desktop\树莓派四轮车项目\四轮车(python3+pyqt5)\Client_Ui.ui'
|
||||||
#
|
#
|
||||||
# Created by: PyQt4 UI code generator 4.11.4
|
# Created by: PyQt5 UI code generator 5.11.3
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
try:
|
|
||||||
_fromUtf8 = QtCore.QString.fromUtf8
|
|
||||||
except AttributeError:
|
|
||||||
def _fromUtf8(s):
|
|
||||||
return s
|
|
||||||
|
|
||||||
try:
|
|
||||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
|
||||||
def _translate(context, text, disambig):
|
|
||||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
|
||||||
except AttributeError:
|
|
||||||
def _translate(context, text, disambig):
|
|
||||||
return QtGui.QApplication.translate(context, text, disambig)
|
|
||||||
|
|
||||||
class Ui_Client(object):
|
class Ui_Client(object):
|
||||||
def setupUi(self, Client):
|
def setupUi(self, Client):
|
||||||
Client.setObjectName(_fromUtf8("Client"))
|
Client.setObjectName("Client")
|
||||||
Client.resize(760, 610)
|
Client.resize(760, 610)
|
||||||
palette = QtGui.QPalette()
|
palette = QtGui.QPalette()
|
||||||
brush = QtGui.QBrush(QtGui.QColor(72, 72, 72))
|
brush = QtGui.QBrush(QtGui.QColor(72, 72, 72))
|
||||||
@ -56,10 +42,10 @@ class Ui_Client(object):
|
|||||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
|
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
|
||||||
Client.setPalette(palette)
|
Client.setPalette(palette)
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(14)
|
font.setPointSize(10)
|
||||||
Client.setFont(font)
|
Client.setFont(font)
|
||||||
Client.setStyleSheet(_fromUtf8("QWidget{\n"
|
Client.setStyleSheet("QWidget{\n"
|
||||||
"background:#484848;\n"
|
"background:#484848;\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"QAbstractButton{\n"
|
"QAbstractButton{\n"
|
||||||
@ -160,330 +146,322 @@ class Ui_Client(object):
|
|||||||
"border-radius:6px;\n"
|
"border-radius:6px;\n"
|
||||||
"background:qradialgradient(spread:pad,cx:0.5,cy:0.5,radius:0.5,fx:0.5,fy:0.5,stop:0.6 #565656,stop:0.8 #565656);\n"
|
"background:qradialgradient(spread:pad,cx:0.5,cy:0.5,radius:0.5,fx:0.5,fy:0.5,stop:0.6 #565656,stop:0.8 #565656);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
""))
|
"")
|
||||||
self.Btn_ForWard = QtGui.QPushButton(Client)
|
self.Btn_ForWard = QtWidgets.QPushButton(Client)
|
||||||
self.Btn_ForWard.setGeometry(QtCore.QRect(120, 450, 90, 30))
|
self.Btn_ForWard.setGeometry(QtCore.QRect(120, 460, 90, 30))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Btn_ForWard.setFont(font)
|
self.Btn_ForWard.setFont(font)
|
||||||
self.Btn_ForWard.setStyleSheet(_fromUtf8(""))
|
self.Btn_ForWard.setStyleSheet("")
|
||||||
self.Btn_ForWard.setObjectName(_fromUtf8("Btn_ForWard"))
|
self.Btn_ForWard.setObjectName("Btn_ForWard")
|
||||||
self.name = QtGui.QLabel(Client)
|
self.name = QtWidgets.QLabel(Client)
|
||||||
self.name.setGeometry(QtCore.QRect(0, 1, 660, 40))
|
self.name.setGeometry(QtCore.QRect(0, 1, 660, 40))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(28)
|
font.setPointSize(28)
|
||||||
font.setBold(True)
|
font.setBold(False)
|
||||||
font.setWeight(75)
|
font.setWeight(50)
|
||||||
self.name.setFont(font)
|
self.name.setFont(font)
|
||||||
self.name.setStyleSheet(_fromUtf8(""))
|
self.name.setStyleSheet("")
|
||||||
self.name.setObjectName(_fromUtf8("name"))
|
self.name.setObjectName("name")
|
||||||
|
self.Btn_Turn_Left = QtWidgets.QPushButton(Client)
|
||||||
self.Btn_Turn_Left = QtGui.QPushButton(Client)
|
self.Btn_Turn_Left.setGeometry(QtCore.QRect(10, 510, 90, 30))
|
||||||
self.Btn_Turn_Left.setGeometry(QtCore.QRect(10, 500, 90, 30))
|
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Btn_Turn_Left.setFont(font)
|
self.Btn_Turn_Left.setFont(font)
|
||||||
self.Btn_Turn_Left.setStyleSheet(_fromUtf8(""))
|
self.Btn_Turn_Left.setStyleSheet("")
|
||||||
self.Btn_Turn_Left.setObjectName(_fromUtf8("Btn_Turn_Left"))
|
self.Btn_Turn_Left.setObjectName("Btn_Turn_Left")
|
||||||
|
self.Btn_BackWard = QtWidgets.QPushButton(Client)
|
||||||
self.Btn_BackWard = QtGui.QPushButton(Client)
|
self.Btn_BackWard.setGeometry(QtCore.QRect(120, 560, 90, 30))
|
||||||
self.Btn_BackWard.setGeometry(QtCore.QRect(120, 550, 90, 30))
|
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Btn_BackWard.setFont(font)
|
self.Btn_BackWard.setFont(font)
|
||||||
self.Btn_BackWard.setStyleSheet(_fromUtf8(""))
|
self.Btn_BackWard.setStyleSheet("")
|
||||||
self.Btn_BackWard.setObjectName(_fromUtf8("Btn_BackWard"))
|
self.Btn_BackWard.setObjectName("Btn_BackWard")
|
||||||
|
self.Btn_Turn_Right = QtWidgets.QPushButton(Client)
|
||||||
self.Btn_Tracking_Faces = QtGui.QPushButton(Client)
|
self.Btn_Turn_Right.setGeometry(QtCore.QRect(230, 510, 90, 30))
|
||||||
self.Btn_Tracking_Faces.setGeometry(QtCore.QRect(240, 450, 90, 30))
|
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
|
||||||
self.Btn_Tracking_Faces.setFont(font)
|
|
||||||
self.Btn_Tracking_Faces.setStyleSheet(_fromUtf8(""))
|
|
||||||
self.Btn_Tracking_Faces.setObjectName(_fromUtf8("Btn_Tracking_Faces"))
|
|
||||||
|
|
||||||
self.Btn_Turn_Right = QtGui.QPushButton(Client)
|
|
||||||
self.Btn_Turn_Right.setGeometry(QtCore.QRect(240, 500, 90, 30))
|
|
||||||
font = QtGui.QFont()
|
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Btn_Turn_Right.setFont(font)
|
self.Btn_Turn_Right.setFont(font)
|
||||||
self.Btn_Turn_Right.setStyleSheet(_fromUtf8(""))
|
self.Btn_Turn_Right.setStyleSheet("")
|
||||||
self.Btn_Turn_Right.setObjectName(_fromUtf8("Btn_Turn_Right"))
|
self.Btn_Turn_Right.setObjectName("Btn_Turn_Right")
|
||||||
self.Btn_Video = QtGui.QPushButton(Client)
|
self.Btn_Video = QtWidgets.QPushButton(Client)
|
||||||
self.Btn_Video.setGeometry(QtCore.QRect(240, 380, 90, 30))
|
self.Btn_Video.setGeometry(QtCore.QRect(230, 380, 90, 30))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Btn_Video.setFont(font)
|
self.Btn_Video.setFont(font)
|
||||||
self.Btn_Video.setStyleSheet(_fromUtf8(""))
|
self.Btn_Video.setStyleSheet("")
|
||||||
self.Btn_Video.setObjectName(_fromUtf8("Btn_Video"))
|
self.Btn_Video.setObjectName("Btn_Video")
|
||||||
self.label_Video = QtGui.QLabel(Client)
|
self.label_Video = QtWidgets.QLabel(Client)
|
||||||
self.label_Video.setGeometry(QtCore.QRect(1, 42, 400, 300))
|
self.label_Video.setGeometry(QtCore.QRect(1, 42, 400, 300))
|
||||||
self.label_Video.setText(_fromUtf8(""))
|
self.label_Video.setText("")
|
||||||
self.label_Video.setObjectName(_fromUtf8("label_Video"))
|
self.label_Video.setObjectName("label_Video")
|
||||||
self.Btn_Down = QtGui.QPushButton(Client)
|
self.Btn_Down = QtWidgets.QPushButton(Client)
|
||||||
self.Btn_Down.setGeometry(QtCore.QRect(510, 480, 75, 30))
|
self.Btn_Down.setGeometry(QtCore.QRect(510, 490, 75, 30))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Btn_Down.setFont(font)
|
self.Btn_Down.setFont(font)
|
||||||
self.Btn_Down.setStyleSheet(_fromUtf8(""))
|
self.Btn_Down.setStyleSheet("")
|
||||||
self.Btn_Down.setObjectName(_fromUtf8("Btn_Down"))
|
self.Btn_Down.setObjectName("Btn_Down")
|
||||||
self.Btn_Left = QtGui.QPushButton(Client)
|
self.Btn_Left = QtWidgets.QPushButton(Client)
|
||||||
self.Btn_Left.setGeometry(QtCore.QRect(440, 450, 75, 30))
|
self.Btn_Left.setGeometry(QtCore.QRect(440, 460, 75, 30))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Btn_Left.setFont(font)
|
self.Btn_Left.setFont(font)
|
||||||
self.Btn_Left.setStyleSheet(_fromUtf8(""))
|
self.Btn_Left.setStyleSheet("")
|
||||||
self.Btn_Left.setObjectName(_fromUtf8("Btn_Left"))
|
self.Btn_Left.setObjectName("Btn_Left")
|
||||||
self.Btn_Home = QtGui.QPushButton(Client)
|
self.Btn_Home = QtWidgets.QPushButton(Client)
|
||||||
self.Btn_Home.setGeometry(QtCore.QRect(510, 450, 75, 30))
|
self.Btn_Home.setGeometry(QtCore.QRect(510, 460, 75, 30))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Btn_Home.setFont(font)
|
self.Btn_Home.setFont(font)
|
||||||
self.Btn_Home.setStyleSheet(_fromUtf8(""))
|
self.Btn_Home.setStyleSheet("")
|
||||||
self.Btn_Home.setObjectName(_fromUtf8("Btn_Home"))
|
self.Btn_Home.setObjectName("Btn_Home")
|
||||||
self.Btn_Up = QtGui.QPushButton(Client)
|
self.Btn_Up = QtWidgets.QPushButton(Client)
|
||||||
self.Btn_Up.setGeometry(QtCore.QRect(510, 420, 75, 30))
|
self.Btn_Up.setGeometry(QtCore.QRect(510, 430, 75, 30))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Btn_Up.setFont(font)
|
self.Btn_Up.setFont(font)
|
||||||
self.Btn_Up.setStyleSheet(_fromUtf8(""))
|
self.Btn_Up.setStyleSheet("")
|
||||||
self.Btn_Up.setObjectName(_fromUtf8("Btn_Up"))
|
self.Btn_Up.setObjectName("Btn_Up")
|
||||||
self.Btn_Right = QtGui.QPushButton(Client)
|
self.Btn_Right = QtWidgets.QPushButton(Client)
|
||||||
self.Btn_Right.setGeometry(QtCore.QRect(580, 450, 75, 30))
|
self.Btn_Right.setGeometry(QtCore.QRect(580, 460, 75, 30))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Btn_Right.setFont(font)
|
self.Btn_Right.setFont(font)
|
||||||
self.Btn_Right.setStyleSheet(_fromUtf8(""))
|
self.Btn_Right.setStyleSheet("")
|
||||||
self.Btn_Right.setObjectName(_fromUtf8("Btn_Right"))
|
self.Btn_Right.setObjectName("Btn_Right")
|
||||||
self.Window_Close = QtGui.QPushButton(Client)
|
self.Window_Close = QtWidgets.QPushButton(Client)
|
||||||
self.Window_Close.setGeometry(QtCore.QRect(710, 1, 50, 40))
|
self.Window_Close.setGeometry(QtCore.QRect(710, 1, 50, 40))
|
||||||
self.Window_Close.setObjectName(_fromUtf8("Window_Close"))
|
self.Window_Close.setObjectName("Window_Close")
|
||||||
self.IP = QtGui.QLineEdit(Client)
|
self.IP = QtWidgets.QLineEdit(Client)
|
||||||
self.IP.setGeometry(QtCore.QRect(10, 380, 101, 30))
|
self.IP.setGeometry(QtCore.QRect(10, 380, 101, 30))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.IP.setFont(font)
|
self.IP.setFont(font)
|
||||||
self.IP.setStyleSheet(_fromUtf8(""))
|
self.IP.setStyleSheet("")
|
||||||
self.IP.setObjectName(_fromUtf8("IP"))
|
self.IP.setObjectName("IP")
|
||||||
self.Btn_Connect = QtGui.QPushButton(Client)
|
self.Btn_Connect = QtWidgets.QPushButton(Client)
|
||||||
self.Btn_Connect.setGeometry(QtCore.QRect(120, 380, 90, 30))
|
self.Btn_Connect.setGeometry(QtCore.QRect(120, 380, 90, 30))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Btn_Connect.setFont(font)
|
self.Btn_Connect.setFont(font)
|
||||||
self.Btn_Connect.setObjectName(_fromUtf8("Btn_Connect"))
|
self.Btn_Connect.setObjectName("Btn_Connect")
|
||||||
self.checkBox_Led1 = QtGui.QCheckBox(Client)
|
self.checkBox_Led1 = QtWidgets.QCheckBox(Client)
|
||||||
self.checkBox_Led1.setGeometry(QtCore.QRect(420, 120, 91, 31))
|
self.checkBox_Led1.setGeometry(QtCore.QRect(420, 120, 91, 31))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.checkBox_Led1.setFont(font)
|
self.checkBox_Led1.setFont(font)
|
||||||
self.checkBox_Led1.setObjectName(_fromUtf8("checkBox_Led1"))
|
self.checkBox_Led1.setObjectName("checkBox_Led1")
|
||||||
self.label_Servo2 = QtGui.QLabel(Client)
|
self.label_Servo2 = QtWidgets.QLabel(Client)
|
||||||
self.label_Servo2.setGeometry(QtCore.QRect(710, 460, 41, 31))
|
self.label_Servo2.setGeometry(QtCore.QRect(710, 470, 41, 31))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(14)
|
font.setPointSize(14)
|
||||||
self.label_Servo2.setFont(font)
|
self.label_Servo2.setFont(font)
|
||||||
self.label_Servo2.setObjectName(_fromUtf8("label_Servo2"))
|
self.label_Servo2.setObjectName("label_Servo2")
|
||||||
self.checkBox_Led2 = QtGui.QCheckBox(Client)
|
self.checkBox_Led2 = QtWidgets.QCheckBox(Client)
|
||||||
self.checkBox_Led2.setGeometry(QtCore.QRect(420, 170, 91, 31))
|
self.checkBox_Led2.setGeometry(QtCore.QRect(420, 170, 91, 31))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.checkBox_Led2.setFont(font)
|
self.checkBox_Led2.setFont(font)
|
||||||
self.checkBox_Led2.setObjectName(_fromUtf8("checkBox_Led2"))
|
self.checkBox_Led2.setObjectName("checkBox_Led2")
|
||||||
self.checkBox_Led3 = QtGui.QCheckBox(Client)
|
self.checkBox_Led3 = QtWidgets.QCheckBox(Client)
|
||||||
self.checkBox_Led3.setGeometry(QtCore.QRect(420, 220, 91, 31))
|
self.checkBox_Led3.setGeometry(QtCore.QRect(420, 220, 91, 31))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.checkBox_Led3.setFont(font)
|
self.checkBox_Led3.setFont(font)
|
||||||
self.checkBox_Led3.setObjectName(_fromUtf8("checkBox_Led3"))
|
self.checkBox_Led3.setObjectName("checkBox_Led3")
|
||||||
self.checkBox_Led4 = QtGui.QCheckBox(Client)
|
self.checkBox_Led4 = QtWidgets.QCheckBox(Client)
|
||||||
self.checkBox_Led4.setGeometry(QtCore.QRect(420, 270, 91, 31))
|
self.checkBox_Led4.setGeometry(QtCore.QRect(420, 270, 91, 31))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.checkBox_Led4.setFont(font)
|
self.checkBox_Led4.setFont(font)
|
||||||
self.checkBox_Led4.setObjectName(_fromUtf8("checkBox_Led4"))
|
self.checkBox_Led4.setObjectName("checkBox_Led4")
|
||||||
self.checkBox_Led5 = QtGui.QCheckBox(Client)
|
self.checkBox_Led5 = QtWidgets.QCheckBox(Client)
|
||||||
self.checkBox_Led5.setGeometry(QtCore.QRect(530, 120, 91, 31))
|
self.checkBox_Led5.setGeometry(QtCore.QRect(530, 120, 91, 31))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.checkBox_Led5.setFont(font)
|
self.checkBox_Led5.setFont(font)
|
||||||
self.checkBox_Led5.setObjectName(_fromUtf8("checkBox_Led5"))
|
self.checkBox_Led5.setObjectName("checkBox_Led5")
|
||||||
self.checkBox_Led6 = QtGui.QCheckBox(Client)
|
self.checkBox_Led6 = QtWidgets.QCheckBox(Client)
|
||||||
self.checkBox_Led6.setGeometry(QtCore.QRect(530, 170, 91, 31))
|
self.checkBox_Led6.setGeometry(QtCore.QRect(530, 170, 91, 31))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.checkBox_Led6.setFont(font)
|
self.checkBox_Led6.setFont(font)
|
||||||
self.checkBox_Led6.setObjectName(_fromUtf8("checkBox_Led6"))
|
self.checkBox_Led6.setObjectName("checkBox_Led6")
|
||||||
self.checkBox_Led7 = QtGui.QCheckBox(Client)
|
self.checkBox_Led7 = QtWidgets.QCheckBox(Client)
|
||||||
self.checkBox_Led7.setGeometry(QtCore.QRect(530, 220, 91, 31))
|
self.checkBox_Led7.setGeometry(QtCore.QRect(530, 220, 91, 31))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.checkBox_Led7.setFont(font)
|
self.checkBox_Led7.setFont(font)
|
||||||
self.checkBox_Led7.setObjectName(_fromUtf8("checkBox_Led7"))
|
self.checkBox_Led7.setObjectName("checkBox_Led7")
|
||||||
self.checkBox_Led8 = QtGui.QCheckBox(Client)
|
self.checkBox_Led8 = QtWidgets.QCheckBox(Client)
|
||||||
self.checkBox_Led8.setGeometry(QtCore.QRect(530, 270, 91, 31))
|
self.checkBox_Led8.setGeometry(QtCore.QRect(530, 270, 91, 31))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.checkBox_Led8.setFont(font)
|
self.checkBox_Led8.setFont(font)
|
||||||
self.checkBox_Led8.setObjectName(_fromUtf8("checkBox_Led8"))
|
self.checkBox_Led8.setObjectName("checkBox_Led8")
|
||||||
self.HSlider_Servo1 = QtGui.QSlider(Client)
|
self.HSlider_Servo1 = QtWidgets.QSlider(Client)
|
||||||
self.HSlider_Servo1.setGeometry(QtCore.QRect(470, 530, 160, 22))
|
self.HSlider_Servo1.setGeometry(QtCore.QRect(470, 540, 160, 22))
|
||||||
self.HSlider_Servo1.setStyleSheet(_fromUtf8(""))
|
|
||||||
self.HSlider_Servo1.setOrientation(QtCore.Qt.Horizontal)
|
|
||||||
self.HSlider_Servo1.setObjectName(_fromUtf8("HSlider_Servo1"))
|
|
||||||
self.VSlider_Servo2 = QtGui.QSlider(Client)
|
|
||||||
self.VSlider_Servo2.setGeometry(QtCore.QRect(680, 400, 22, 160))
|
|
||||||
self.VSlider_Servo2.setStyleSheet(_fromUtf8(""))
|
|
||||||
self.VSlider_Servo2.setOrientation(QtCore.Qt.Vertical)
|
|
||||||
self.VSlider_Servo2.setObjectName(_fromUtf8("VSlider_Servo2"))
|
|
||||||
self.label_Servo1 = QtGui.QLabel(Client)
|
|
||||||
self.label_Servo1.setGeometry(QtCore.QRect(530, 560, 41, 31))
|
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
|
font.setPointSize(10)
|
||||||
|
self.HSlider_Servo1.setFont(font)
|
||||||
|
self.HSlider_Servo1.setStyleSheet("")
|
||||||
|
self.HSlider_Servo1.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.HSlider_Servo1.setObjectName("HSlider_Servo1")
|
||||||
|
self.VSlider_Servo2 = QtWidgets.QSlider(Client)
|
||||||
|
self.VSlider_Servo2.setGeometry(QtCore.QRect(680, 410, 22, 160))
|
||||||
|
self.VSlider_Servo2.setStyleSheet("")
|
||||||
|
self.VSlider_Servo2.setOrientation(QtCore.Qt.Vertical)
|
||||||
|
self.VSlider_Servo2.setObjectName("VSlider_Servo2")
|
||||||
|
self.label_Servo1 = QtWidgets.QLabel(Client)
|
||||||
|
self.label_Servo1.setGeometry(QtCore.QRect(530, 570, 41, 31))
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setFamily("3ds")
|
||||||
font.setPointSize(14)
|
font.setPointSize(14)
|
||||||
self.label_Servo1.setFont(font)
|
self.label_Servo1.setFont(font)
|
||||||
self.label_Servo1.setObjectName(_fromUtf8("label_Servo1"))
|
self.label_Servo1.setObjectName("label_Servo1")
|
||||||
self.checkBox_Led_Mode2 = QtGui.QCheckBox(Client)
|
self.checkBox_Led_Mode2 = QtWidgets.QCheckBox(Client)
|
||||||
self.checkBox_Led_Mode2.setGeometry(QtCore.QRect(640, 170, 101, 31))
|
self.checkBox_Led_Mode2.setGeometry(QtCore.QRect(640, 170, 91, 31))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.checkBox_Led_Mode2.setFont(font)
|
self.checkBox_Led_Mode2.setFont(font)
|
||||||
self.checkBox_Led_Mode2.setObjectName(_fromUtf8("checkBox_Led_Mode2"))
|
self.checkBox_Led_Mode2.setObjectName("checkBox_Led_Mode2")
|
||||||
self.checkBox_Led_Mode3 = QtGui.QCheckBox(Client)
|
self.checkBox_Led_Mode3 = QtWidgets.QCheckBox(Client)
|
||||||
self.checkBox_Led_Mode3.setGeometry(QtCore.QRect(640, 220, 101, 31))
|
self.checkBox_Led_Mode3.setGeometry(QtCore.QRect(640, 220, 91, 31))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.checkBox_Led_Mode3.setFont(font)
|
self.checkBox_Led_Mode3.setFont(font)
|
||||||
self.checkBox_Led_Mode3.setObjectName(_fromUtf8("checkBox_Led_Mode3"))
|
self.checkBox_Led_Mode3.setObjectName("checkBox_Led_Mode3")
|
||||||
self.checkBox_Led_Mode4 = QtGui.QCheckBox(Client)
|
self.checkBox_Led_Mode4 = QtWidgets.QCheckBox(Client)
|
||||||
self.checkBox_Led_Mode4.setGeometry(QtCore.QRect(640, 270, 101, 31))
|
self.checkBox_Led_Mode4.setGeometry(QtCore.QRect(640, 270, 91, 31))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.checkBox_Led_Mode4.setFont(font)
|
self.checkBox_Led_Mode4.setFont(font)
|
||||||
self.checkBox_Led_Mode4.setObjectName(_fromUtf8("checkBox_Led_Mode4"))
|
self.checkBox_Led_Mode4.setObjectName("checkBox_Led_Mode4")
|
||||||
self.checkBox_Led_Mode1 = QtGui.QCheckBox(Client)
|
self.checkBox_Led_Mode1 = QtWidgets.QCheckBox(Client)
|
||||||
self.checkBox_Led_Mode1.setGeometry(QtCore.QRect(640, 120, 101, 31))
|
self.checkBox_Led_Mode1.setGeometry(QtCore.QRect(640, 120, 91, 31))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.checkBox_Led_Mode1.setFont(font)
|
self.checkBox_Led_Mode1.setFont(font)
|
||||||
self.checkBox_Led_Mode1.setObjectName(_fromUtf8("checkBox_Led_Mode1"))
|
self.checkBox_Led_Mode1.setObjectName("checkBox_Led_Mode1")
|
||||||
self.Color_R = QtGui.QLineEdit(Client)
|
self.Color_R = QtWidgets.QLineEdit(Client)
|
||||||
self.Color_R.setGeometry(QtCore.QRect(560, 90, 30, 20))
|
self.Color_R.setGeometry(QtCore.QRect(560, 90, 30, 20))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Color_R.setFont(font)
|
self.Color_R.setFont(font)
|
||||||
self.Color_R.setObjectName(_fromUtf8("Color_R"))
|
self.Color_R.setObjectName("Color_R")
|
||||||
self.Color_G = QtGui.QLineEdit(Client)
|
self.Color_G = QtWidgets.QLineEdit(Client)
|
||||||
self.Color_G.setGeometry(QtCore.QRect(630, 90, 30, 20))
|
self.Color_G.setGeometry(QtCore.QRect(630, 90, 30, 20))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Color_G.setFont(font)
|
self.Color_G.setFont(font)
|
||||||
self.Color_G.setObjectName(_fromUtf8("Color_G"))
|
self.Color_G.setObjectName("Color_G")
|
||||||
self.Color_B = QtGui.QLineEdit(Client)
|
self.Color_B = QtWidgets.QLineEdit(Client)
|
||||||
self.Color_B.setGeometry(QtCore.QRect(700, 90, 30, 20))
|
self.Color_B.setGeometry(QtCore.QRect(700, 90, 30, 20))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Color_B.setFont(font)
|
self.Color_B.setFont(font)
|
||||||
self.Color_B.setObjectName(_fromUtf8("Color_B"))
|
self.Color_B.setObjectName("Color_B")
|
||||||
self.HSlider_FineServo2 = QtGui.QSlider(Client)
|
self.HSlider_FineServo2 = QtWidgets.QSlider(Client)
|
||||||
self.HSlider_FineServo2.setGeometry(QtCore.QRect(480, 370, 160, 22))
|
self.HSlider_FineServo2.setGeometry(QtCore.QRect(480, 380, 160, 22))
|
||||||
self.HSlider_FineServo2.setOrientation(QtCore.Qt.Horizontal)
|
self.HSlider_FineServo2.setOrientation(QtCore.Qt.Horizontal)
|
||||||
self.HSlider_FineServo2.setObjectName(_fromUtf8("HSlider_FineServo2"))
|
self.HSlider_FineServo2.setObjectName("HSlider_FineServo2")
|
||||||
self.HSlider_FineServo1 = QtGui.QSlider(Client)
|
self.HSlider_FineServo1 = QtWidgets.QSlider(Client)
|
||||||
self.HSlider_FineServo1.setGeometry(QtCore.QRect(480, 320, 160, 22))
|
self.HSlider_FineServo1.setGeometry(QtCore.QRect(480, 330, 160, 22))
|
||||||
self.HSlider_FineServo1.setOrientation(QtCore.Qt.Horizontal)
|
self.HSlider_FineServo1.setOrientation(QtCore.Qt.Horizontal)
|
||||||
self.HSlider_FineServo1.setObjectName(_fromUtf8("HSlider_FineServo1"))
|
self.HSlider_FineServo1.setObjectName("HSlider_FineServo1")
|
||||||
self.label_FineServo1 = QtGui.QLabel(Client)
|
self.label_FineServo1 = QtWidgets.QLabel(Client)
|
||||||
self.label_FineServo1.setGeometry(QtCore.QRect(650, 320, 41, 31))
|
self.label_FineServo1.setGeometry(QtCore.QRect(650, 330, 41, 31))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(14)
|
font.setPointSize(14)
|
||||||
self.label_FineServo1.setFont(font)
|
self.label_FineServo1.setFont(font)
|
||||||
self.label_FineServo1.setObjectName(_fromUtf8("label_FineServo1"))
|
self.label_FineServo1.setObjectName("label_FineServo1")
|
||||||
self.label_FineServo2 = QtGui.QLabel(Client)
|
self.label_FineServo2 = QtWidgets.QLabel(Client)
|
||||||
self.label_FineServo2.setGeometry(QtCore.QRect(650, 360, 41, 31))
|
self.label_FineServo2.setGeometry(QtCore.QRect(650, 370, 41, 31))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(14)
|
font.setPointSize(14)
|
||||||
self.label_FineServo2.setFont(font)
|
self.label_FineServo2.setFont(font)
|
||||||
self.label_FineServo2.setObjectName(_fromUtf8("label_FineServo2"))
|
self.label_FineServo2.setObjectName("label_FineServo2")
|
||||||
self.Window_Min = QtGui.QPushButton(Client)
|
self.Window_Min = QtWidgets.QPushButton(Client)
|
||||||
self.Window_Min.setGeometry(QtCore.QRect(660, 1, 50, 40))
|
self.Window_Min.setGeometry(QtCore.QRect(660, 1, 50, 40))
|
||||||
self.Window_Min.setObjectName(_fromUtf8("Window_Min"))
|
self.Window_Min.setObjectName("Window_Min")
|
||||||
self.R = QtGui.QLabel(Client)
|
self.R = QtWidgets.QLabel(Client)
|
||||||
self.R.setGeometry(QtCore.QRect(530, 90, 16, 20))
|
self.R.setGeometry(QtCore.QRect(530, 90, 16, 20))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.R.setFont(font)
|
self.R.setFont(font)
|
||||||
self.R.setObjectName(_fromUtf8("R"))
|
self.R.setObjectName("R")
|
||||||
self.G = QtGui.QLabel(Client)
|
self.G = QtWidgets.QLabel(Client)
|
||||||
self.G.setGeometry(QtCore.QRect(600, 90, 16, 20))
|
self.G.setGeometry(QtCore.QRect(600, 90, 16, 20))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.G.setFont(font)
|
self.G.setFont(font)
|
||||||
self.G.setObjectName(_fromUtf8("G"))
|
self.G.setObjectName("G")
|
||||||
self.B = QtGui.QLabel(Client)
|
self.B = QtWidgets.QLabel(Client)
|
||||||
self.B.setGeometry(QtCore.QRect(670, 90, 16, 20))
|
self.B.setGeometry(QtCore.QRect(670, 90, 16, 20))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.B.setFont(font)
|
self.B.setFont(font)
|
||||||
self.B.setObjectName(_fromUtf8("B"))
|
self.B.setObjectName("B")
|
||||||
self.Led_Module = QtGui.QLabel(Client)
|
self.Led_Module = QtWidgets.QLabel(Client)
|
||||||
self.Led_Module.setGeometry(QtCore.QRect(410, 90, 111, 25))
|
self.Led_Module.setGeometry(QtCore.QRect(410, 90, 111, 25))
|
||||||
self.Led_Module.setObjectName(_fromUtf8("Led_Module"))
|
|
||||||
self.Servo1 = QtGui.QLabel(Client)
|
|
||||||
self.Servo1.setGeometry(QtCore.QRect(420, 320, 54, 20))
|
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Servo1.setFont(font)
|
self.Led_Module.setFont(font)
|
||||||
self.Servo1.setObjectName(_fromUtf8("Servo1"))
|
self.Led_Module.setObjectName("Led_Module")
|
||||||
self.Servo2 = QtGui.QLabel(Client)
|
self.Servo1 = QtWidgets.QLabel(Client)
|
||||||
self.Servo2.setGeometry(QtCore.QRect(420, 370, 54, 20))
|
self.Servo1.setGeometry(QtCore.QRect(420, 330, 54, 20))
|
||||||
|
self.Servo1.setObjectName("Servo1")
|
||||||
|
self.Servo2 = QtWidgets.QLabel(Client)
|
||||||
|
self.Servo2.setGeometry(QtCore.QRect(420, 380, 54, 20))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Servo2.setFont(font)
|
self.Servo2.setFont(font)
|
||||||
self.Servo2.setObjectName(_fromUtf8("Servo2"))
|
self.Servo2.setObjectName("Servo2")
|
||||||
self.progress_Power = QtGui.QProgressBar(Client)
|
self.progress_Power = QtWidgets.QProgressBar(Client)
|
||||||
self.progress_Power.setGeometry(QtCore.QRect(20, 550, 70, 30))
|
self.progress_Power.setGeometry(QtCore.QRect(20, 560, 70, 30))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.progress_Power.setFont(font)
|
self.progress_Power.setFont(font)
|
||||||
self.progress_Power.setStyleSheet(_fromUtf8("QProgressBar {\n"
|
self.progress_Power.setStyleSheet("QProgressBar {\n"
|
||||||
"border: 2px solid grey;\n"
|
"border: 2px solid grey;\n"
|
||||||
"border-radius: 5px;\n"
|
"border-radius: 5px;\n"
|
||||||
"background-color: #FFFFFF;\n"
|
"background-color: #FFFFFF;\n"
|
||||||
@ -498,103 +476,119 @@ class Ui_Client(object):
|
|||||||
"text-align: center; \n"
|
"text-align: center; \n"
|
||||||
"color: rgb(152,251,152);\n"
|
"color: rgb(152,251,152);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
""))
|
"")
|
||||||
self.progress_Power.setProperty("value", 0)
|
self.progress_Power.setProperty("value", 0)
|
||||||
self.progress_Power.setObjectName(_fromUtf8("progress_Power"))
|
self.progress_Power.setObjectName("progress_Power")
|
||||||
self.Btn_Buzzer = QtGui.QPushButton(Client)
|
self.Btn_Buzzer = QtWidgets.QPushButton(Client)
|
||||||
self.Btn_Buzzer.setGeometry(QtCore.QRect(120, 500, 90, 30))
|
self.Btn_Buzzer.setGeometry(QtCore.QRect(120, 510, 90, 30))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Btn_Buzzer.setFont(font)
|
self.Btn_Buzzer.setFont(font)
|
||||||
self.Btn_Buzzer.setObjectName(_fromUtf8("Btn_Buzzer"))
|
self.Btn_Buzzer.setObjectName("Btn_Buzzer")
|
||||||
self.Ultrasonic = QtGui.QPushButton(Client)
|
self.Btn_Mode1 = QtWidgets.QRadioButton(Client)
|
||||||
self.Ultrasonic.setGeometry(QtCore.QRect(401, 41, 180, 30))
|
self.Btn_Mode1.setGeometry(QtCore.QRect(335, 410, 90, 30))
|
||||||
self.Ultrasonic.setObjectName(_fromUtf8("Ultrasonic"))
|
|
||||||
self.Light = QtGui.QPushButton(Client)
|
|
||||||
self.Light.setGeometry(QtCore.QRect(581, 41, 179, 30))
|
|
||||||
self.Light.setObjectName(_fromUtf8("Light"))
|
|
||||||
self.Btn_Mode1 = QtGui.QRadioButton(Client)
|
|
||||||
self.Btn_Mode1.setGeometry(QtCore.QRect(340, 400, 90, 30))
|
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Btn_Mode1.setFont(font)
|
self.Btn_Mode1.setFont(font)
|
||||||
self.Btn_Mode1.setObjectName(_fromUtf8("Btn_Mode1"))
|
self.Btn_Mode1.setObjectName("Btn_Mode1")
|
||||||
self.Btn_Mode2 = QtGui.QRadioButton(Client)
|
self.Btn_Mode2 = QtWidgets.QRadioButton(Client)
|
||||||
self.Btn_Mode2.setGeometry(QtCore.QRect(340, 450, 90, 30))
|
self.Btn_Mode2.setGeometry(QtCore.QRect(335, 460, 90, 30))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Btn_Mode2.setFont(font)
|
self.Btn_Mode2.setFont(font)
|
||||||
self.Btn_Mode2.setObjectName(_fromUtf8("Btn_Mode2"))
|
self.Btn_Mode2.setObjectName("Btn_Mode2")
|
||||||
self.Btn_Mode3 = QtGui.QRadioButton(Client)
|
self.Btn_Mode3 = QtWidgets.QRadioButton(Client)
|
||||||
self.Btn_Mode3.setGeometry(QtCore.QRect(340, 500, 90, 30))
|
self.Btn_Mode3.setGeometry(QtCore.QRect(335, 510, 90, 30))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Btn_Mode3.setFont(font)
|
self.Btn_Mode3.setFont(font)
|
||||||
self.Btn_Mode3.setObjectName(_fromUtf8("Btn_Mode3"))
|
self.Btn_Mode3.setObjectName("Btn_Mode3")
|
||||||
self.Btn_Mode4 = QtGui.QRadioButton(Client)
|
self.Btn_Mode4 = QtWidgets.QRadioButton(Client)
|
||||||
self.Btn_Mode4.setGeometry(QtCore.QRect(340, 550, 90, 30))
|
self.Btn_Mode4.setGeometry(QtCore.QRect(335, 560, 90, 30))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
self.Btn_Mode4.setFont(font)
|
self.Btn_Mode4.setFont(font)
|
||||||
self.Btn_Mode4.setObjectName(_fromUtf8("Btn_Mode4"))
|
self.Btn_Mode4.setObjectName("Btn_Mode4")
|
||||||
|
self.Btn_Tracking_Faces = QtWidgets.QPushButton(Client)
|
||||||
|
self.Btn_Tracking_Faces.setGeometry(QtCore.QRect(230, 460, 90, 30))
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setFamily("3ds")
|
||||||
|
font.setPointSize(10)
|
||||||
|
self.Btn_Tracking_Faces.setFont(font)
|
||||||
|
self.Btn_Tracking_Faces.setStyleSheet("")
|
||||||
|
self.Btn_Tracking_Faces.setObjectName("Btn_Tracking_Faces")
|
||||||
|
self.Ultrasonic = QtWidgets.QPushButton(Client)
|
||||||
|
self.Ultrasonic.setGeometry(QtCore.QRect(400, 41, 180, 30))
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setFamily("3ds")
|
||||||
|
font.setPointSize(10)
|
||||||
|
self.Ultrasonic.setFont(font)
|
||||||
|
self.Ultrasonic.setObjectName("Ultrasonic")
|
||||||
|
self.Light = QtWidgets.QPushButton(Client)
|
||||||
|
self.Light.setGeometry(QtCore.QRect(580, 41, 180, 30))
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setFamily("3ds")
|
||||||
|
font.setPointSize(10)
|
||||||
|
self.Light.setFont(font)
|
||||||
|
self.Light.setObjectName("Light")
|
||||||
|
|
||||||
self.retranslateUi(Client)
|
self.retranslateUi(Client)
|
||||||
QtCore.QMetaObject.connectSlotsByName(Client)
|
QtCore.QMetaObject.connectSlotsByName(Client)
|
||||||
|
|
||||||
def retranslateUi(self, Client):
|
def retranslateUi(self, Client):
|
||||||
Client.setWindowTitle(_translate("Client", "freenove", None))
|
_translate = QtCore.QCoreApplication.translate
|
||||||
self.Btn_ForWard.setText(_translate("Client", "ForWard", None))
|
Client.setWindowTitle(_translate("Client", "freenove"))
|
||||||
self.name.setText(_translate("Client", "Freenove", None))
|
self.Btn_ForWard.setText(_translate("Client", "ForWard"))
|
||||||
self.Btn_Turn_Left.setText(_translate("Client", "Turn Left", None))
|
self.name.setText(_translate("Client", "Freenove"))
|
||||||
self.Btn_BackWard.setText(_translate("Client", "BackWard", None))
|
self.Btn_Turn_Left.setText(_translate("Client", "Turn Left"))
|
||||||
self.Btn_Turn_Right.setText(_translate("Client", "Turn Right", None))
|
self.Btn_BackWard.setText(_translate("Client", "BackWard"))
|
||||||
self.Btn_Video.setText(_translate("Client", "Open Video", None))
|
self.Btn_Turn_Right.setText(_translate("Client", "Turn Right"))
|
||||||
self.Btn_Tracking_Faces.setText(_translate("Client", "Tracing-On", None))
|
self.Btn_Video.setText(_translate("Client", "Open Video"))
|
||||||
|
self.Btn_Down.setText(_translate("Client", "Down"))
|
||||||
self.Btn_Down.setText(_translate("Client", "Down", None))
|
self.Btn_Left.setText(_translate("Client", "Left"))
|
||||||
self.Btn_Left.setText(_translate("Client", "Left", None))
|
self.Btn_Home.setText(_translate("Client", "Home"))
|
||||||
self.Btn_Home.setText(_translate("Client", "Home", None))
|
self.Btn_Up.setText(_translate("Client", "Up"))
|
||||||
self.Btn_Up.setText(_translate("Client", "Up", None))
|
self.Btn_Right.setText(_translate("Client", "Right"))
|
||||||
self.Btn_Right.setText(_translate("Client", "Right", None))
|
self.Window_Close.setText(_translate("Client", "×"))
|
||||||
self.Window_Close.setText(_translate("Client", "×", None))
|
self.IP.setText(_translate("Client", "IP Address"))
|
||||||
self.IP.setText(_translate("Client", "IP address", None))
|
self.Btn_Connect.setText(_translate("Client", "Connect"))
|
||||||
self.Btn_Connect.setText(_translate("Client", "Connect", None))
|
self.checkBox_Led1.setText(_translate("Client", "Led1"))
|
||||||
self.checkBox_Led1.setText(_translate("Client", "Led1", None))
|
self.label_Servo2.setText(_translate("Client", "0"))
|
||||||
self.label_Servo2.setText(_translate("Client", "0", None))
|
self.checkBox_Led2.setText(_translate("Client", "Led2"))
|
||||||
self.checkBox_Led2.setText(_translate("Client", "Led2", None))
|
self.checkBox_Led3.setText(_translate("Client", "Led3"))
|
||||||
self.checkBox_Led3.setText(_translate("Client", "Led3", None))
|
self.checkBox_Led4.setText(_translate("Client", "Led4"))
|
||||||
self.checkBox_Led4.setText(_translate("Client", "Led4", None))
|
self.checkBox_Led5.setText(_translate("Client", "Led5"))
|
||||||
self.checkBox_Led5.setText(_translate("Client", "Led5", None))
|
self.checkBox_Led6.setText(_translate("Client", "Led6"))
|
||||||
self.checkBox_Led6.setText(_translate("Client", "Led6", None))
|
self.checkBox_Led7.setText(_translate("Client", "Led7"))
|
||||||
self.checkBox_Led7.setText(_translate("Client", "Led7", None))
|
self.checkBox_Led8.setText(_translate("Client", "Led8"))
|
||||||
self.checkBox_Led8.setText(_translate("Client", "Led8", None))
|
self.label_Servo1.setText(_translate("Client", "90"))
|
||||||
self.label_Servo1.setText(_translate("Client", "90", None))
|
self.checkBox_Led_Mode2.setText(_translate("Client", "Led_Mode2"))
|
||||||
self.checkBox_Led_Mode2.setText(_translate("Client", "Led_Mode2", None))
|
self.checkBox_Led_Mode3.setText(_translate("Client", "Led_Mode3"))
|
||||||
self.checkBox_Led_Mode3.setText(_translate("Client", "Led_Mode3", None))
|
self.checkBox_Led_Mode4.setText(_translate("Client", "Led_Mode4"))
|
||||||
self.checkBox_Led_Mode4.setText(_translate("Client", "Led_Mode4", None))
|
self.checkBox_Led_Mode1.setText(_translate("Client", "Led_Mode1"))
|
||||||
self.checkBox_Led_Mode1.setText(_translate("Client", "Led_Mode1", None))
|
self.Color_R.setText(_translate("Client", "255"))
|
||||||
self.Color_R.setText(_translate("Client", "255", None))
|
self.Color_G.setText(_translate("Client", "0"))
|
||||||
self.Color_G.setText(_translate("Client", "0", None))
|
self.Color_B.setText(_translate("Client", "0"))
|
||||||
self.Color_B.setText(_translate("Client", "0", None))
|
self.label_FineServo1.setText(_translate("Client", "0"))
|
||||||
self.label_FineServo1.setText(_translate("Client", "0", None))
|
self.label_FineServo2.setText(_translate("Client", "0"))
|
||||||
self.label_FineServo2.setText(_translate("Client", "0", None))
|
self.Window_Min.setText(_translate("Client", "-"))
|
||||||
self.Window_Min.setText(_translate("Client", "-", None))
|
self.R.setText(_translate("Client", "R"))
|
||||||
self.R.setText(_translate("Client", "R", None))
|
self.G.setText(_translate("Client", "G"))
|
||||||
self.G.setText(_translate("Client", "G", None))
|
self.B.setText(_translate("Client", "B"))
|
||||||
self.B.setText(_translate("Client", "B", None))
|
self.Led_Module.setText(_translate("Client", "Led Module"))
|
||||||
self.Led_Module.setText(_translate("Client", "Led Module", None))
|
self.Servo1.setText(_translate("Client", "Servo 1"))
|
||||||
self.Servo1.setText(_translate("Client", "Servo 1", None))
|
self.Servo2.setText(_translate("Client", "Servo 2"))
|
||||||
self.Servo2.setText(_translate("Client", "Servo 2", None))
|
self.Btn_Buzzer.setText(_translate("Client", "Buzzer"))
|
||||||
self.Btn_Buzzer.setText(_translate("Client", "Buzzer", None))
|
self.Btn_Mode1.setText(_translate("Client", "M-Free"))
|
||||||
self.Ultrasonic.setText(_translate("Client", "Ultrasonic", None))
|
self.Btn_Mode2.setText(_translate("Client", "M-Light"))
|
||||||
self.Light.setText(_translate("Client", "Light", None))
|
self.Btn_Mode3.setText(_translate("Client", "M-Sonic"))
|
||||||
self.Btn_Mode1.setText(_translate("Client", "M-Free", None))
|
self.Btn_Mode4.setText(_translate("Client", "M-Line"))
|
||||||
self.Btn_Mode2.setText(_translate("Client", "M-Light", None))
|
self.Btn_Tracking_Faces.setText(_translate("Client", "Tracing-On"))
|
||||||
self.Btn_Mode3.setText(_translate("Client", "M-Sonic", None))
|
self.Ultrasonic.setText(_translate("Client", "Ultrasonic"))
|
||||||
self.Btn_Mode4.setText(_translate("Client", "M-Line", None))
|
self.Light.setText(_translate("Client", "Light"))
|
||||||
|
|
||||||
|
@ -15,12 +15,10 @@ from Command import COMMAND as cmd
|
|||||||
from Thread import *
|
from Thread import *
|
||||||
from Client_Ui import Ui_Client
|
from Client_Ui import Ui_Client
|
||||||
from Video import *
|
from Video import *
|
||||||
from PyQt4.QtCore import *
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
from PyQt4 import QtGui, QtCore
|
from PyQt5.QtCore import *
|
||||||
from PyQt4.QtGui import *
|
from PyQt5.QtWidgets import *
|
||||||
from PyQt4.QtCore import pyqtSignature
|
from PyQt5.QtGui import *
|
||||||
from PyQt4.QtGui import (QApplication, QMainWindow, QGraphicsScene)
|
|
||||||
|
|
||||||
class mywindow(QMainWindow,Ui_Client):
|
class mywindow(QMainWindow,Ui_Client):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
global timer
|
global timer
|
||||||
@ -147,8 +145,8 @@ class mywindow(QMainWindow,Ui_Client):
|
|||||||
|
|
||||||
self.Window_Min.clicked.connect(self.windowMinimumed)
|
self.Window_Min.clicked.connect(self.windowMinimumed)
|
||||||
self.Window_Close.clicked.connect(self.close)
|
self.Window_Close.clicked.connect(self.close)
|
||||||
timer = QTimer(self)
|
self.timer = QTimer(self)
|
||||||
self.connect(timer, SIGNAL("timeout()"), self.time)
|
self.timer.timeout.connect(self.time)
|
||||||
def mousePressEvent(self, event):
|
def mousePressEvent(self, event):
|
||||||
if event.button()==Qt.LeftButton:
|
if event.button()==Qt.LeftButton:
|
||||||
self.m_drag=True
|
self.m_drag=True
|
||||||
@ -323,10 +321,10 @@ class mywindow(QMainWindow,Ui_Client):
|
|||||||
|
|
||||||
def on_btn_video(self):
|
def on_btn_video(self):
|
||||||
if self.Btn_Video.text()=='Open Video':
|
if self.Btn_Video.text()=='Open Video':
|
||||||
timer.start(34)
|
self.timer.start(34)
|
||||||
self.Btn_Video.setText('Close Video')
|
self.Btn_Video.setText('Close Video')
|
||||||
elif self.Btn_Video.text()=='Close Video':
|
elif self.Btn_Video.text()=='Close Video':
|
||||||
timer.stop()
|
self.timer.stop()
|
||||||
self.Btn_Video.setText('Open Video')
|
self.Btn_Video.setText('Open Video')
|
||||||
def on_btn_Up(self):
|
def on_btn_Up(self):
|
||||||
self.servo2=self.servo2+10
|
self.servo2=self.servo2+10
|
||||||
@ -490,20 +488,19 @@ class mywindow(QMainWindow,Ui_Client):
|
|||||||
def on_btn_Mode(self,Mode):
|
def on_btn_Mode(self,Mode):
|
||||||
if Mode.text() == "M-Free":
|
if Mode.text() == "M-Free":
|
||||||
if Mode.isChecked() == True:
|
if Mode.isChecked() == True:
|
||||||
timer.start(34)
|
self.timer.start(34)
|
||||||
self.TCP.sendData(cmd.CMD_MODE+self.intervalChar+'one'+self.endChar)
|
self.TCP.sendData(cmd.CMD_MODE+self.intervalChar+'one'+self.endChar)
|
||||||
|
|
||||||
if Mode.text() == "M-Light":
|
if Mode.text() == "M-Light":
|
||||||
if Mode.isChecked() == True:
|
if Mode.isChecked() == True:
|
||||||
timer.stop()
|
self.timer.stop()
|
||||||
self.TCP.sendData(cmd.CMD_MODE+self.intervalChar+'two'+self.endChar)
|
self.TCP.sendData(cmd.CMD_MODE+self.intervalChar+'two'+self.endChar)
|
||||||
if Mode.text() == "M-Sonic":
|
if Mode.text() == "M-Sonic":
|
||||||
if Mode.isChecked() == True:
|
if Mode.isChecked() == True:
|
||||||
timer.stop()
|
self.timer.stop()
|
||||||
self.TCP.sendData(cmd.CMD_MODE+self.intervalChar+'three'+self.endChar)
|
self.TCP.sendData(cmd.CMD_MODE+self.intervalChar+'three'+self.endChar)
|
||||||
if Mode.text() == "M-Line":
|
if Mode.text() == "M-Line":
|
||||||
if Mode.isChecked() == True:
|
if Mode.isChecked() == True:
|
||||||
timer.stop()
|
self.timer.stop()
|
||||||
self.TCP.sendData(cmd.CMD_MODE+self.intervalChar+'four'+self.endChar)
|
self.TCP.sendData(cmd.CMD_MODE+self.intervalChar+'four'+self.endChar)
|
||||||
|
|
||||||
|
|
||||||
@ -515,12 +512,12 @@ class mywindow(QMainWindow,Ui_Client):
|
|||||||
self.streaming=Thread(target=self.TCP.streaming,args=(self.h,))
|
self.streaming=Thread(target=self.TCP.streaming,args=(self.h,))
|
||||||
self.streaming.start()
|
self.streaming.start()
|
||||||
except:
|
except:
|
||||||
print 'video error'
|
print ('video error')
|
||||||
try:
|
try:
|
||||||
self.recv=Thread(target=self.recvmassage)
|
self.recv=Thread(target=self.recvmassage)
|
||||||
self.recv.start()
|
self.recv.start()
|
||||||
except:
|
except:
|
||||||
print 'recv error'
|
print ('recv error')
|
||||||
self.Btn_Connect.setText( "Disconnect")
|
self.Btn_Connect.setText( "Disconnect")
|
||||||
print ('Server address:'+str(self.h)+'\n')
|
print ('Server address:'+str(self.h)+'\n')
|
||||||
elif self.Btn_Connect.text()=="Disconnect":
|
elif self.Btn_Connect.text()=="Disconnect":
|
||||||
@ -535,7 +532,7 @@ class mywindow(QMainWindow,Ui_Client):
|
|||||||
|
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
timer.stop()
|
self.timer.stop()
|
||||||
try:
|
try:
|
||||||
stop_thread(self.recv)
|
stop_thread(self.recv)
|
||||||
stop_thread(self.streaming)
|
stop_thread(self.streaming)
|
||||||
@ -623,12 +620,16 @@ class mywindow(QMainWindow,Ui_Client):
|
|||||||
self.VSlider_Servo2.setValue(self.servo2)
|
self.VSlider_Servo2.setValue(self.servo2)
|
||||||
def time(self):
|
def time(self):
|
||||||
self.TCP.video_Flag=False
|
self.TCP.video_Flag=False
|
||||||
|
try:
|
||||||
if self.is_valid_jpg('video.jpg'):
|
if self.is_valid_jpg('video.jpg'):
|
||||||
self.label_Video.setPixmap(QtGui.QPixmap(QtCore.QString.fromUtf8('video.jpg')))
|
self.label_Video.setPixmap(QPixmap('video.jpg'))
|
||||||
if self.Btn_Tracking_Faces.text()=="Tracing-Off":
|
if self.Btn_Tracking_Faces.text()=="Tracing-Off":
|
||||||
self.find_Face(self.TCP.face_x,self.TCP.face_y)
|
self.find_Face(self.TCP.face_x,self.TCP.face_y)
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
self.TCP.video_Flag=True
|
self.TCP.video_Flag=True
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
myshow=mywindow()
|
myshow=mywindow()
|
||||||
|
@ -42,14 +42,14 @@ class VideoStreaming:
|
|||||||
return bValid
|
return bValid
|
||||||
|
|
||||||
def face_detect(self,img):
|
def face_detect(self,img):
|
||||||
if sys.platform.startswith('win'):
|
if sys.platform.startswith('win') or sys.platform.startswith('darwin'):
|
||||||
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
|
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
|
||||||
faces = self.face_cascade.detectMultiScale(gray,1.3,5)
|
faces = self.face_cascade.detectMultiScale(gray,1.3,5)
|
||||||
if len(faces)>0 :
|
if len(faces)>0 :
|
||||||
for (x,y,w,h) in faces:
|
for (x,y,w,h) in faces:
|
||||||
self.face_x=float(x+w/2.0)
|
self.face_x=float(x+w/2.0)
|
||||||
self.face_y=float(y+h/2.0)
|
self.face_y=float(y+h/2.0)
|
||||||
img = cv2.circle(img, (x+w/2,y+h/2), (w+h)/4, (0, 255, 0), 2)
|
img= cv2.circle(img, (int(self.face_x),int(self.face_y)), int((w+h)/4), (0, 255, 0), 2)
|
||||||
else:
|
else:
|
||||||
self.face_x=0
|
self.face_x=0
|
||||||
self.face_y=0
|
self.face_y=0
|
||||||
@ -66,24 +66,25 @@ class VideoStreaming:
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
stream_bytes= self.connection.read(4)
|
stream_bytes= self.connection.read(4)
|
||||||
leng=struct.unpack('L', stream_bytes[:4])
|
leng=struct.unpack('<L', stream_bytes[:4])
|
||||||
jpg=self.connection.read(leng[0])
|
jpg=self.connection.read(leng[0])
|
||||||
if self.IsValidImage4Bytes(jpg):
|
if self.IsValidImage4Bytes(jpg):
|
||||||
image = cv2.imdecode(np.frombuffer(jpg, dtype=np.uint8), cv2.IMREAD_COLOR)
|
image = cv2.imdecode(np.frombuffer(jpg, dtype=np.uint8), cv2.IMREAD_COLOR)
|
||||||
if self.video_Flag:
|
if self.video_Flag:
|
||||||
self.face_detect(image)
|
self.face_detect(image)
|
||||||
self.video_Flag=False
|
self.video_Flag=False
|
||||||
except:
|
except Exception as e:
|
||||||
|
print (e)
|
||||||
break
|
break
|
||||||
|
|
||||||
def sendData(self,s):
|
def sendData(self,s):
|
||||||
if self.connect_Flag:
|
if self.connect_Flag:
|
||||||
self.client_socket1.send(s)
|
self.client_socket1.send(s.encode('utf-8'))
|
||||||
|
|
||||||
def recvData(self):
|
def recvData(self):
|
||||||
data=""
|
data=""
|
||||||
try:
|
try:
|
||||||
data=self.client_socket1.recv(1024)
|
data=self.client_socket1.recv(1024).decode('utf-8')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return data
|
return data
|
||||||
@ -92,9 +93,9 @@ class VideoStreaming:
|
|||||||
try:
|
try:
|
||||||
self.client_socket1.connect((ip, 5000))
|
self.client_socket1.connect((ip, 5000))
|
||||||
self.connect_Flag=True
|
self.connect_Flag=True
|
||||||
print "Connecttion Successful !"
|
print ("Connecttion Successful !")
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print "Connect to server Faild!: Server IP is right? Server is opend?"
|
print ("Connect to server Faild!: Server IP is right? Server is opend?")
|
||||||
self.connect_Flag=False
|
self.connect_Flag=False
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -4,24 +4,16 @@ class Adc:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
# Get I2C bus
|
# Get I2C bus
|
||||||
self.bus = smbus.SMBus(1)
|
self.bus = smbus.SMBus(1)
|
||||||
|
|
||||||
# I2C address of the device
|
# I2C address of the device
|
||||||
self.ADDRESS = 0x48
|
self.ADDRESS = 0x48
|
||||||
|
|
||||||
# PCF8591 Command
|
# PCF8591 Command
|
||||||
self.PCF8591_CMD =0x40 #Command
|
self.PCF8591_CMD =0x40 #Command
|
||||||
# ADS7830 Command Set
|
|
||||||
self.ADS7830_CMD_SD_SINGLE = 0x84 # Single-Ended Inputs
|
# ADS7830 Command
|
||||||
self.ADS7830_CMD_SNGL_CHANNEL_0 = 0x00 # +IN = CH0, -IN = GND
|
self.ADS7830_CMD = 0x84 # Single-Ended Inputs
|
||||||
self.ADS7830_CMD_SNGL_CHANNEL_1 = 0x40 # +IN = CH1, -IN = GND
|
|
||||||
self.ADS7830_CMD_SNGL_CHANNEL_2 = 0x10 # +IN = CH2, -IN = GND
|
|
||||||
self.ADS7830_CMD_SNGL_CHANNEL_3 = 0x50 # +IN = CH3, -IN = GND
|
|
||||||
self.ADS7830_CMD_SNGL_CHANNEL_4 = 0x20 # +IN = CH4, -IN = GND
|
|
||||||
self.ADS7830_CMD_SNGL_CHANNEL_5 = 0x60 # +IN = CH5, -IN = GND
|
|
||||||
self.ADS7830_CMD_SNGL_CHANNEL_6 = 0x30 # +IN = CH6, -IN = GND
|
|
||||||
self.ADS7830_CMD_SNGL_CHANNEL_7 = 0x70 # +IN = CH7, -IN = GND
|
|
||||||
self.ADS7830_CMD_PD_POWER_DOWN = 0x00 # Power Down Between A/D Converter Conversions
|
|
||||||
self.ADS7830_CMD_PD_REF_OFF = 0x04 # Internal Reference OFF and A/D Converter ON
|
|
||||||
self.ADS7830_CMD_PD_REF_ON = 0x08 # Internal Reference ON and A/D Converter OFF
|
|
||||||
self.ADS7830_CMD_PD_REF_ON_AD_ON = 0x0C # Internal Reference ON and A/D Converter ON
|
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
aa=self.bus.read_byte_data(self.ADDRESS,0xf4)
|
aa=self.bus.read_byte_data(self.ADDRESS,0xf4)
|
||||||
if aa < 150:
|
if aa < 150:
|
||||||
@ -49,30 +41,14 @@ class Adc:
|
|||||||
return voltage
|
return voltage
|
||||||
def recvADS7830(self,channel):
|
def recvADS7830(self,channel):
|
||||||
"""Select the Command data from the given provided value above"""
|
"""Select the Command data from the given provided value above"""
|
||||||
if channel == 0:
|
COMMAND_SET = self.ADS7830_CMD | ((((channel<<2)|(channel>>1))&0x07)<<4)
|
||||||
COMMAND_SET = (self.ADS7830_CMD_SD_SINGLE | self.ADS7830_CMD_SNGL_CHANNEL_0)
|
|
||||||
elif channel == 1:
|
|
||||||
COMMAND_SET = (self.ADS7830_CMD_SD_SINGLE | self.ADS7830_CMD_SNGL_CHANNEL_1)
|
|
||||||
elif channel == 2:
|
|
||||||
COMMAND_SET = (self.ADS7830_CMD_SD_SINGLE | self.ADS7830_CMD_SNGL_CHANNEL_2)
|
|
||||||
elif channel == 3:
|
|
||||||
COMMAND_SET = (self.ADS7830_CMD_SD_SINGLE | self.ADS7830_CMD_SNGL_CHANNEL_3)
|
|
||||||
elif channel == 4:
|
|
||||||
COMMAND_SET = (self.ADS7830_CMD_SD_SINGLE | self.ADS7830_CMD_SNGL_CHANNEL_4)
|
|
||||||
elif channel == 5:
|
|
||||||
COMMAND_SET = (self.ADS7830_CMD_SD_SINGLE | self.ADS7830_CMD_SNGL_CHANNEL_5)
|
|
||||||
elif channel == 6:
|
|
||||||
COMMAND_SET = (self.ADS7830_CMD_SD_SINGLE | self.ADS7830_CMD_SNGL_CHANNEL_6)
|
|
||||||
elif channel == 7:
|
|
||||||
COMMAND_SET = (self.ADS7830_CMD_SD_SINGLE | self.ADS7830_CMD_SNGL_CHANNEL_7)
|
|
||||||
|
|
||||||
self.bus.write_byte(self.ADDRESS,COMMAND_SET)
|
self.bus.write_byte(self.ADDRESS,COMMAND_SET)
|
||||||
while(1):
|
while(1):
|
||||||
value1 = self.bus.read_byte(self.ADDRESS)
|
value1 = self.bus.read_byte(self.ADDRESS)
|
||||||
value2 = self.bus.read_byte(self.ADDRESS)
|
value2 = self.bus.read_byte(self.ADDRESS)
|
||||||
if value1==value2:
|
if value1==value2:
|
||||||
break;
|
break;
|
||||||
voltage = value1 / 256.0 * 3.3 #calculate the voltage value
|
voltage = value1 / 255.0 * 3.3 #calculate the voltage value
|
||||||
voltage = round(voltage,2)
|
voltage = round(voltage,2)
|
||||||
return voltage
|
return voltage
|
||||||
|
|
||||||
|
@ -125,12 +125,12 @@ if __name__ == '__main__':
|
|||||||
print ('Program is starting ... ')
|
print ('Program is starting ... ')
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
print "Chaser animation"
|
print ("Chaser animation")
|
||||||
led.colorWipe(led.strip, Color(255,0, 0)) # Red wipe
|
led.colorWipe(led.strip, Color(255,0, 0)) # Red wipe
|
||||||
led.colorWipe(led.strip, Color(0, 255, 0)) # Green wipe
|
led.colorWipe(led.strip, Color(0, 255, 0)) # Green wipe
|
||||||
led.colorWipe(led.strip, Color(0, 0, 255)) # Blue wipe
|
led.colorWipe(led.strip, Color(0, 0, 255)) # Blue wipe
|
||||||
led.theaterChaseRainbow(led.strip)
|
led.theaterChaseRainbow(led.strip)
|
||||||
print "Rainbow animation"
|
print ("Rainbow animation")
|
||||||
led.rainbow(led.strip)
|
led.rainbow(led.strip)
|
||||||
led.rainbowCycle(led.strip)
|
led.rainbowCycle(led.strip)
|
||||||
led.colorWipe(led.strip, Color(0,0,0),10)
|
led.colorWipe(led.strip, Color(0,0,0),10)
|
||||||
|
@ -5,15 +5,15 @@ import struct
|
|||||||
import time
|
import time
|
||||||
import picamera
|
import picamera
|
||||||
import sys,getopt
|
import sys,getopt
|
||||||
from threading import Thread
|
|
||||||
from server_ui import Ui_server_ui
|
|
||||||
from PyQt4.QtCore import *
|
|
||||||
from Thread import *
|
from Thread import *
|
||||||
from PyQt4 import QtGui, QtCore
|
from threading import Thread
|
||||||
from PyQt4.QtGui import *
|
|
||||||
from PyQt4.QtCore import pyqtSignature
|
|
||||||
from PyQt4.QtGui import (QApplication, QMainWindow, QGraphicsScene)
|
|
||||||
from server import Server
|
from server import Server
|
||||||
|
from server_ui import Ui_server_ui
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
from PyQt5.QtCore import *
|
||||||
|
from PyQt5.QtWidgets import *
|
||||||
|
from PyQt5.QtGui import *
|
||||||
|
|
||||||
|
|
||||||
class mywindow(QMainWindow,Ui_server_ui):
|
class mywindow(QMainWindow,Ui_server_ui):
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ class mywindow(QMainWindow,Ui_server_ui):
|
|||||||
self.opts,self.args = getopt.getopt(sys.argv[1:],"tn")
|
self.opts,self.args = getopt.getopt(sys.argv[1:],"tn")
|
||||||
for o,a in self.opts:
|
for o,a in self.opts:
|
||||||
if o in ('-t'):
|
if o in ('-t'):
|
||||||
print "Open TCP"
|
print ("Open TCP")
|
||||||
self.TCP_Server.StartTcpServer()
|
self.TCP_Server.StartTcpServer()
|
||||||
self.ReadData=Thread(target=self.TCP_Server.readdata)
|
self.ReadData=Thread(target=self.TCP_Server.readdata)
|
||||||
self.SendVideo=Thread(target=self.TCP_Server.sendvideo)
|
self.SendVideo=Thread(target=self.TCP_Server.sendvideo)
|
||||||
@ -77,7 +77,7 @@ class mywindow(QMainWindow,Ui_server_ui):
|
|||||||
self.TCP_Server.StopTcpServer()
|
self.TCP_Server.StopTcpServer()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
print "Close TCP"
|
print ("Close TCP")
|
||||||
QCoreApplication.instance().quit()
|
QCoreApplication.instance().quit()
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
def on_pushButton(self):
|
def on_pushButton(self):
|
||||||
@ -85,7 +85,7 @@ class mywindow(QMainWindow,Ui_server_ui):
|
|||||||
self.label.setText("Server On")
|
self.label.setText("Server On")
|
||||||
self.Button_Server.setText("Off")
|
self.Button_Server.setText("Off")
|
||||||
self.TCP_Server.tcp_Flag = True
|
self.TCP_Server.tcp_Flag = True
|
||||||
print "Open TCP"
|
print ("Open TCP")
|
||||||
self.TCP_Server.StartTcpServer()
|
self.TCP_Server.StartTcpServer()
|
||||||
self.SendVideo=Thread(target=self.TCP_Server.sendvideo)
|
self.SendVideo=Thread(target=self.TCP_Server.sendvideo)
|
||||||
self.ReadData=Thread(target=self.TCP_Server.readdata)
|
self.ReadData=Thread(target=self.TCP_Server.readdata)
|
||||||
@ -106,7 +106,7 @@ class mywindow(QMainWindow,Ui_server_ui):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
self.TCP_Server.StopTcpServer()
|
self.TCP_Server.StopTcpServer()
|
||||||
print "Close TCP"
|
print ("Close TCP")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
|
@ -39,8 +39,10 @@ class Server:
|
|||||||
self.intervalChar='#'
|
self.intervalChar='#'
|
||||||
def get_interface_ip(self):
|
def get_interface_ip(self):
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
return socket.inet_ntoa(fcntl.ioctl(s.fileno(), 0x8915, struct.pack('256s',
|
return socket.inet_ntoa(fcntl.ioctl(s.fileno(),
|
||||||
"wlan0"[:15]))[20:24])
|
0x8915,
|
||||||
|
struct.pack('256s',b'wlan0'[:15])
|
||||||
|
)[20:24])
|
||||||
def StartTcpServer(self):
|
def StartTcpServer(self):
|
||||||
HOST=str(self.get_interface_ip())
|
HOST=str(self.get_interface_ip())
|
||||||
self.server_socket1 = socket.socket()
|
self.server_socket1 = socket.socket()
|
||||||
@ -58,8 +60,8 @@ class Server:
|
|||||||
try:
|
try:
|
||||||
self.connection.close()
|
self.connection.close()
|
||||||
self.connection1.close()
|
self.connection1.close()
|
||||||
except Exception , e:
|
except Exception as e:
|
||||||
print '\n'+"No client connection"
|
print ('\n'+"No client connection")
|
||||||
|
|
||||||
def Reset(self):
|
def Reset(self):
|
||||||
self.StopTcpServer()
|
self.StopTcpServer()
|
||||||
@ -68,23 +70,24 @@ class Server:
|
|||||||
self.ReadData=Thread(target=self.readdata)
|
self.ReadData=Thread(target=self.readdata)
|
||||||
self.SendVideo.start()
|
self.SendVideo.start()
|
||||||
self.ReadData.start()
|
self.ReadData.start()
|
||||||
|
def send(self,data):
|
||||||
|
self.connection1.send(data.encode('utf-8'))
|
||||||
def sendvideo(self):
|
def sendvideo(self):
|
||||||
try:
|
try:
|
||||||
self.connection,self.client_address = self.server_socket.accept()
|
self.connection,self.client_address = self.server_socket.accept()
|
||||||
self.connection=self.connection.makefile('rb')
|
self.connection=self.connection.makefile('wb')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
self.server_socket.close()
|
self.server_socket.close()
|
||||||
try:
|
try:
|
||||||
with picamera.PiCamera() as camera:
|
with picamera.PiCamera() as camera:
|
||||||
camera.resolution = (400,300) # pi camera resolution
|
camera.resolution = (400,300) # pi camera resolution
|
||||||
camera.framerate = 30 # 15 frames/sec
|
camera.framerate = 15 # 15 frames/sec
|
||||||
time.sleep(2) # give 2 secs for camera to initilize
|
time.sleep(2) # give 2 secs for camera to initilize
|
||||||
start = time.time()
|
start = time.time()
|
||||||
stream = io.BytesIO()
|
stream = io.BytesIO()
|
||||||
# send jpeg format video stream
|
# send jpeg format video stream
|
||||||
print "Start transmit ... "
|
print ("Start transmit ... ")
|
||||||
for foo in camera.capture_continuous(stream, 'jpeg', use_video_port = True):
|
for foo in camera.capture_continuous(stream, 'jpeg', use_video_port = True):
|
||||||
try:
|
try:
|
||||||
self.connection.flush()
|
self.connection.flush()
|
||||||
@ -98,8 +101,9 @@ class Server:
|
|||||||
self.connection.write(b)
|
self.connection.write(b)
|
||||||
stream.seek(0)
|
stream.seek(0)
|
||||||
stream.truncate()
|
stream.truncate()
|
||||||
except :
|
except Exception as e:
|
||||||
print "End transmit ... "
|
print(e)
|
||||||
|
print ("End transmit ... " )
|
||||||
break
|
break
|
||||||
except:
|
except:
|
||||||
#print "Camera unintall"
|
#print "Camera unintall"
|
||||||
@ -127,14 +131,14 @@ class Server:
|
|||||||
def readdata(self):
|
def readdata(self):
|
||||||
try:
|
try:
|
||||||
self.connection1,self.client_address1 = self.server_socket1.accept()
|
self.connection1,self.client_address1 = self.server_socket1.accept()
|
||||||
print "Client connection successful !"
|
print ("Client connection successful !")
|
||||||
except:
|
except:
|
||||||
print "Client connect failed"
|
print ("Client connect failed")
|
||||||
restCmd=""
|
restCmd=""
|
||||||
self.server_socket1.close()
|
self.server_socket1.close()
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
AllData=restCmd+self.connection1.recv(1024)
|
AllData=restCmd+self.connection1.recv(1024).decode('utf-8')
|
||||||
except:
|
except:
|
||||||
if self.tcp_Flag:
|
if self.tcp_Flag:
|
||||||
self.Reset()
|
self.Reset()
|
||||||
@ -249,7 +253,7 @@ class Server:
|
|||||||
elif cmd.CMD_POWER in data:
|
elif cmd.CMD_POWER in data:
|
||||||
ADC_Power=self.adc.recvADC(2)*3
|
ADC_Power=self.adc.recvADC(2)*3
|
||||||
try:
|
try:
|
||||||
self.connection1.send(cmd.CMD_POWER+'#'+str(ADC_Power)+'\n')
|
self.send(cmd.CMD_POWER+'#'+str(ADC_Power)+'\n')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
self.StopTcpServer()
|
self.StopTcpServer()
|
||||||
@ -258,7 +262,7 @@ class Server:
|
|||||||
ADC_Ultrasonic=self.ultrasonic.get_distance()
|
ADC_Ultrasonic=self.ultrasonic.get_distance()
|
||||||
if ADC_Ultrasonic==self.ultrasonic.get_distance():
|
if ADC_Ultrasonic==self.ultrasonic.get_distance():
|
||||||
try:
|
try:
|
||||||
self.connection1.send(cmd.CMD_SONIC+"#"+str(ADC_Ultrasonic)+'\n')
|
self.send(cmd.CMD_SONIC+"#"+str(ADC_Ultrasonic)+'\n')
|
||||||
except:
|
except:
|
||||||
self.sonic=False
|
self.sonic=False
|
||||||
self.ultrasonicTimer = threading.Timer(0.13,self.sendUltrasonic)
|
self.ultrasonicTimer = threading.Timer(0.13,self.sendUltrasonic)
|
||||||
@ -268,7 +272,7 @@ class Server:
|
|||||||
ADC_Light1=self.adc.recvADC(0)
|
ADC_Light1=self.adc.recvADC(0)
|
||||||
ADC_Light2=self.adc.recvADC(1)
|
ADC_Light2=self.adc.recvADC(1)
|
||||||
try:
|
try:
|
||||||
self.connection1.send(cmd.CMD_LIGHT+'#'+str(ADC_Light1)+'#'+str(ADC_Light2)+'\n')
|
self.send(cmd.CMD_LIGHT+'#'+str(ADC_Light1)+'#'+str(ADC_Light2)+'\n')
|
||||||
except:
|
except:
|
||||||
self.Light=False
|
self.Light=False
|
||||||
self.lightTimer = threading.Timer(0.17,self.sendLight)
|
self.lightTimer = threading.Timer(0.17,self.sendLight)
|
||||||
@ -292,4 +296,4 @@ class Server:
|
|||||||
else:
|
else:
|
||||||
self.buzzer.run('0')
|
self.buzzer.run('0')
|
||||||
if __name__=='__main__':
|
if __name__=='__main__':
|
||||||
passS
|
pass
|
||||||
|
@ -1,32 +1,21 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Form implementation generated from reading ui file 'C:/Users/Freenove/Desktop/test/qss/server_ui.ui'
|
# Form implementation generated from reading ui file 'C:\Users\Freenove\Desktop\树莓派四轮车项目\四轮车(python3+pyqt5)代码\server_ui.ui'
|
||||||
#
|
#
|
||||||
# Created by: PyQt4 UI code generator 4.11.4
|
# Created by: PyQt5 UI code generator 5.11.3
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
try:
|
|
||||||
_fromUtf8 = QtCore.QString.fromUtf8
|
|
||||||
except AttributeError:
|
|
||||||
def _fromUtf8(s):
|
|
||||||
return s
|
|
||||||
|
|
||||||
try:
|
|
||||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
|
||||||
def _translate(context, text, disambig):
|
|
||||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
|
||||||
except AttributeError:
|
|
||||||
def _translate(context, text, disambig):
|
|
||||||
return QtGui.QApplication.translate(context, text, disambig)
|
|
||||||
|
|
||||||
class Ui_server_ui(object):
|
class Ui_server_ui(object):
|
||||||
def setupUi(self, server_ui):
|
def setupUi(self, server_ui):
|
||||||
server_ui.setObjectName(_fromUtf8("server_ui"))
|
server_ui.setObjectName("server_ui")
|
||||||
server_ui.resize(400, 300)
|
server_ui.resize(400, 300)
|
||||||
server_ui.setStyleSheet(_fromUtf8("QWidget{\n"
|
font = QtGui.QFont()
|
||||||
|
font.setFamily("3ds")
|
||||||
|
server_ui.setFont(font)
|
||||||
|
server_ui.setStyleSheet("QWidget{\n"
|
||||||
"background:#484848;\n"
|
"background:#484848;\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"QAbstractButton{\n"
|
"QAbstractButton{\n"
|
||||||
@ -82,46 +71,53 @@ class Ui_server_ui(object):
|
|||||||
"}\n"
|
"}\n"
|
||||||
"QLineEdit{\n"
|
"QLineEdit{\n"
|
||||||
"lineedit-password-character:9679;\n"
|
"lineedit-password-character:9679;\n"
|
||||||
"}"))
|
"}")
|
||||||
self.label = QtGui.QLabel(server_ui)
|
self.label = QtWidgets.QLabel(server_ui)
|
||||||
self.label.setGeometry(QtCore.QRect(100, 150, 200, 42))
|
self.label.setGeometry(QtCore.QRect(100, 150, 200, 42))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(26)
|
font.setPointSize(26)
|
||||||
self.label.setFont(font)
|
self.label.setFont(font)
|
||||||
self.label.setObjectName(_fromUtf8("label"))
|
self.label.setObjectName("label")
|
||||||
self.Button_Server = QtGui.QPushButton(server_ui)
|
self.Button_Server = QtWidgets.QPushButton(server_ui)
|
||||||
self.Button_Server.setGeometry(QtCore.QRect(150, 220, 100, 40))
|
self.Button_Server.setGeometry(QtCore.QRect(150, 220, 100, 40))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(12)
|
font.setPointSize(12)
|
||||||
self.Button_Server.setFont(font)
|
self.Button_Server.setFont(font)
|
||||||
self.Button_Server.setObjectName(_fromUtf8("Button_Server"))
|
self.Button_Server.setObjectName("Button_Server")
|
||||||
self.label_2 = QtGui.QLabel(server_ui)
|
self.label_2 = QtWidgets.QLabel(server_ui)
|
||||||
self.label_2.setGeometry(QtCore.QRect(0, 0, 301, 41))
|
self.label_2.setGeometry(QtCore.QRect(0, 0, 301, 41))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("3ds"))
|
font.setFamily("3ds")
|
||||||
font.setPointSize(28)
|
font.setPointSize(28)
|
||||||
font.setBold(True)
|
font.setBold(True)
|
||||||
font.setWeight(75)
|
font.setWeight(75)
|
||||||
self.label_2.setFont(font)
|
self.label_2.setFont(font)
|
||||||
self.label_2.setStyleSheet(_fromUtf8(""))
|
self.label_2.setStyleSheet("")
|
||||||
self.label_2.setObjectName(_fromUtf8("label_2"))
|
self.label_2.setObjectName("label_2")
|
||||||
self.pushButton_Close = QtGui.QPushButton(server_ui)
|
self.pushButton_Close = QtWidgets.QPushButton(server_ui)
|
||||||
self.pushButton_Close.setGeometry(QtCore.QRect(350, 0, 50, 40))
|
self.pushButton_Close.setGeometry(QtCore.QRect(350, 0, 50, 40))
|
||||||
self.pushButton_Close.setObjectName(_fromUtf8("pushButton_Close"))
|
font = QtGui.QFont()
|
||||||
self.pushButton_Min = QtGui.QPushButton(server_ui)
|
font.setFamily("3ds")
|
||||||
|
self.pushButton_Close.setFont(font)
|
||||||
|
self.pushButton_Close.setObjectName("pushButton_Close")
|
||||||
|
self.pushButton_Min = QtWidgets.QPushButton(server_ui)
|
||||||
self.pushButton_Min.setGeometry(QtCore.QRect(300, 0, 50, 40))
|
self.pushButton_Min.setGeometry(QtCore.QRect(300, 0, 50, 40))
|
||||||
self.pushButton_Min.setObjectName(_fromUtf8("pushButton_Min"))
|
font = QtGui.QFont()
|
||||||
|
font.setFamily("3ds")
|
||||||
|
self.pushButton_Min.setFont(font)
|
||||||
|
self.pushButton_Min.setObjectName("pushButton_Min")
|
||||||
|
|
||||||
self.retranslateUi(server_ui)
|
self.retranslateUi(server_ui)
|
||||||
QtCore.QMetaObject.connectSlotsByName(server_ui)
|
QtCore.QMetaObject.connectSlotsByName(server_ui)
|
||||||
|
|
||||||
def retranslateUi(self, server_ui):
|
def retranslateUi(self, server_ui):
|
||||||
server_ui.setWindowTitle(_translate("server_ui", "Form", None))
|
_translate = QtCore.QCoreApplication.translate
|
||||||
self.label.setText(_translate("server_ui", "Server Off", None))
|
server_ui.setWindowTitle(_translate("server_ui", "Form"))
|
||||||
self.Button_Server.setText(_translate("server_ui", "Off", None))
|
self.label.setText(_translate("server_ui", "Server Off"))
|
||||||
self.label_2.setText(_translate("server_ui", "Freenove", None))
|
self.Button_Server.setText(_translate("server_ui", "Off"))
|
||||||
self.pushButton_Close.setText(_translate("server_ui", "×", None))
|
self.label_2.setText(_translate("server_ui", "freenove"))
|
||||||
self.pushButton_Min.setText(_translate("server_ui", "-", None))
|
self.pushButton_Close.setText(_translate("server_ui", "×"))
|
||||||
|
self.pushButton_Min.setText(_translate("server_ui", "-"))
|
||||||
|
|
||||||
|
@ -11,13 +11,13 @@ def test_Led():
|
|||||||
led.ledIndex(0x20,0,0,255) #blue
|
led.ledIndex(0x20,0,0,255) #blue
|
||||||
led.ledIndex(0x40,128,0,128) #purple
|
led.ledIndex(0x40,128,0,128) #purple
|
||||||
led.ledIndex(0x80,255,255,255) #white'''
|
led.ledIndex(0x80,255,255,255) #white'''
|
||||||
print "The LED has been lit, the color is red orange yellow green cyan-blue blue white"
|
print ("The LED has been lit, the color is red orange yellow green cyan-blue blue white")
|
||||||
time.sleep(3) #wait 3s
|
time.sleep(3) #wait 3s
|
||||||
led.colorWipe(led.strip, Color(0,0,0)) #turn off the light
|
led.colorWipe(led.strip, Color(0,0,0)) #turn off the light
|
||||||
print "\nEnd of program"
|
print ("\nEnd of program")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
led.colorWipe(led.strip, Color(0,0,0)) #turn off the light
|
led.colorWipe(led.strip, Color(0,0,0)) #turn off the light
|
||||||
print "\nEnd of program"
|
print ("\nEnd of program")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -26,22 +26,22 @@ PWM=Motor()
|
|||||||
def test_Motor():
|
def test_Motor():
|
||||||
try:
|
try:
|
||||||
PWM.setMotorModel(1000,1000,1000,1000) #Forward
|
PWM.setMotorModel(1000,1000,1000,1000) #Forward
|
||||||
print "The car is moving forward"
|
print ("The car is moving forward")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
PWM.setMotorModel(-1000,-1000,-1000,-1000) #Back
|
PWM.setMotorModel(-1000,-1000,-1000,-1000) #Back
|
||||||
print "The car is going backwards"
|
print ("The car is going backwards")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
PWM.setMotorModel(-1500,-1500,2000,2000) #Left
|
PWM.setMotorModel(-1500,-1500,2000,2000) #Left
|
||||||
print "The car is turning left"
|
print ("The car is turning left")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
PWM.setMotorModel(2000,2000,-1500,-1500) #Right
|
PWM.setMotorModel(2000,2000,-1500,-1500) #Right
|
||||||
print "The car is turning right"
|
print ("The car is turning right")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
PWM.setMotorModel(0,0,0,0) #Stop
|
PWM.setMotorModel(0,0,0,0) #Stop
|
||||||
print "\nEnd of program"
|
print ("\nEnd of program")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
PWM.setMotorModel(0,0,0,0)
|
PWM.setMotorModel(0,0,0,0)
|
||||||
print "\nEnd of program"
|
print ("\nEnd of program")
|
||||||
|
|
||||||
|
|
||||||
from Ultrasonic import *
|
from Ultrasonic import *
|
||||||
@ -53,7 +53,7 @@ def test_Ultrasonic():
|
|||||||
print ("Obstacle distance is "+str(data)+"CM")
|
print ("Obstacle distance is "+str(data)+"CM")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print "\nEnd of program"
|
print ("\nEnd of program")
|
||||||
|
|
||||||
|
|
||||||
from Line_Tracking import *
|
from Line_Tracking import *
|
||||||
@ -61,13 +61,13 @@ def test_Infrared():
|
|||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
if GPIO.input(IR01)!=True and GPIO.input(IR02)==True and GPIO.input(IR03)!=True:
|
if GPIO.input(IR01)!=True and GPIO.input(IR02)==True and GPIO.input(IR03)!=True:
|
||||||
print 'Middle'
|
print ('Middle')
|
||||||
elif GPIO.input(IR01)!=True and GPIO.input(IR02)!=True and GPIO.input(IR03)==True:
|
elif GPIO.input(IR01)!=True and GPIO.input(IR02)!=True and GPIO.input(IR03)==True:
|
||||||
print 'Right'
|
print ('Right')
|
||||||
elif GPIO.input(IR01)==True and GPIO.input(IR02)!=True and GPIO.input(IR03)!=True:
|
elif GPIO.input(IR01)==True and GPIO.input(IR02)!=True and GPIO.input(IR03)!=True:
|
||||||
print 'Left'
|
print ('Left')
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print "\nEnd of program"
|
print ("\nEnd of program")
|
||||||
|
|
||||||
|
|
||||||
from servo import *
|
from servo import *
|
||||||
@ -90,7 +90,7 @@ def test_Servo():
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pwm.setServoPwm('0',90)
|
pwm.setServoPwm('0',90)
|
||||||
pwm.setServoPwm('1',90)
|
pwm.setServoPwm('1',90)
|
||||||
print "\nEnd of program"
|
print ("\nEnd of program")
|
||||||
|
|
||||||
|
|
||||||
from ADC import *
|
from ADC import *
|
||||||
@ -105,9 +105,9 @@ def test_Adc():
|
|||||||
Power=adc.recvADC(2)
|
Power=adc.recvADC(2)
|
||||||
print ("The battery voltage is "+str(Power*3)+"V")
|
print ("The battery voltage is "+str(Power*3)+"V")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
print '\n'
|
print ('\n')
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print "\nEnd of program"
|
print ("\nEnd of program")
|
||||||
|
|
||||||
from Buzzer import *
|
from Buzzer import *
|
||||||
buzzer=Buzzer()
|
buzzer=Buzzer()
|
||||||
@ -115,21 +115,21 @@ def test_Buzzer():
|
|||||||
try:
|
try:
|
||||||
buzzer.run('1')
|
buzzer.run('1')
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
print "1S"
|
print ("1S")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
print "2S"
|
print ("2S")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
print "3S"
|
print ("3S")
|
||||||
buzzer.run('0')
|
buzzer.run('0')
|
||||||
print "\nEnd of program"
|
print ("\nEnd of program")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
buzzer.run('0')
|
buzzer.run('0')
|
||||||
print "\nEnd of program"
|
print ("\nEnd of program")
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
def test_Camera():
|
def test_Camera():
|
||||||
try:
|
try:
|
||||||
print "\nOpen camera"
|
print ("\nOpen camera")
|
||||||
capturing_Flag = True
|
capturing_Flag = True
|
||||||
cap = cv2.VideoCapture(0)
|
cap = cv2.VideoCapture(0)
|
||||||
while(capturing_Flag):
|
while(capturing_Flag):
|
||||||
@ -138,7 +138,7 @@ def test_Camera():
|
|||||||
cv2.waitKey(5)
|
cv2.waitKey(5)
|
||||||
cv2.destroyAllWindows()
|
cv2.destroyAllWindows()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print "\nClose camera"
|
print ("\nClose camera")
|
||||||
capturing_Flag = False
|
capturing_Flag = False
|
||||||
|
|
||||||
# Main program logic follows:
|
# Main program logic follows:
|
||||||
@ -147,7 +147,7 @@ if __name__ == '__main__':
|
|||||||
print ('Program is starting ... ')
|
print ('Program is starting ... ')
|
||||||
import sys
|
import sys
|
||||||
if len(sys.argv)<2:
|
if len(sys.argv)<2:
|
||||||
print "Parameter error: Please assign the device"
|
print ("Parameter error: Please assign the device")
|
||||||
exit()
|
exit()
|
||||||
if sys.argv[1] == 'Led':
|
if sys.argv[1] == 'Led':
|
||||||
test_Led()
|
test_Led()
|
||||||
|
31
Code/setup_macos.py
Normal file
31
Code/setup_macos.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
flag=0x00
|
||||||
|
for x in range(1,4):
|
||||||
|
if os.system("python3 -m pip install --upgrade pip") == 0:
|
||||||
|
flag=flag | 0x01
|
||||||
|
break
|
||||||
|
for x in range(1,4):
|
||||||
|
if os.system("pip3 install PyQt5") == 0:
|
||||||
|
flag=flag | 0x02
|
||||||
|
break
|
||||||
|
for x in range(1,4):
|
||||||
|
if os.system("pip3 install Pillow") == 0:
|
||||||
|
flag=flag | 0x04
|
||||||
|
break
|
||||||
|
for x in range(1,4):
|
||||||
|
if os.system("pip3 install opencv-python-headless") == 0:
|
||||||
|
flag=flag | 0x08
|
||||||
|
break
|
||||||
|
for x in range(1,4):
|
||||||
|
if os.system("pip3 install numpy") == 0:
|
||||||
|
flag=flag | 0x10
|
||||||
|
break
|
||||||
|
if flag==0x1f:
|
||||||
|
os.system("pip3 list")
|
||||||
|
print("\nAll libraries installed successfully")
|
||||||
|
else:
|
||||||
|
print ("\nSome libraries have not been installed yet. Please run 'python3 setup_macos.py' again")
|
||||||
|
|
||||||
|
|
38
Code/setup_windows.py
Normal file
38
Code/setup_windows.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
flag=0x00
|
||||||
|
for x in range(1,4):
|
||||||
|
if os.system("python3 -m pip install --upgrade pip") == 0:
|
||||||
|
flag=flag | 0x01
|
||||||
|
break
|
||||||
|
for x in range(1,4):
|
||||||
|
if os.system("pip3 install PyQt5") == 0:
|
||||||
|
flag=flag | 0x02
|
||||||
|
break
|
||||||
|
for x in range(1,4):
|
||||||
|
if os.system("pip3 install pyqt5-tools") == 0:
|
||||||
|
flag=flag | 0x04
|
||||||
|
break
|
||||||
|
for x in range(1,4):
|
||||||
|
if os.system("pip3 install Pillow") == 0:
|
||||||
|
flag=flag | 0x08
|
||||||
|
break
|
||||||
|
for x in range(1,4):
|
||||||
|
if os.system("pip3 install opencv-python") == 0:
|
||||||
|
flag=flag | 0x10
|
||||||
|
break
|
||||||
|
for x in range(1,4):
|
||||||
|
if os.system("pip3 install numpy") == 0:
|
||||||
|
flag=flag | 0x20
|
||||||
|
break
|
||||||
|
if flag==0x3f:
|
||||||
|
os.system("pip3 list && pause")
|
||||||
|
print("\nAll libraries installed successfully")
|
||||||
|
else:
|
||||||
|
print ("\nSome libraries have not been installed yet. Please run 'sudo python3 setup_windows.py' again")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
Tutorial.pdf
BIN
Tutorial.pdf
Binary file not shown.
Loading…
Reference in New Issue
Block a user