Last active
August 29, 2015 14:17
-
-
Save shurru/889897b237b5d41d927e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gui_main | |
import sys | |
import numpy | |
from PyQt4 import QtCore, QtGui | |
import PyQt4.Qwt5 as Qwt | |
import matplotlib | |
import serial | |
import threading | |
global readervar | |
def reader(): | |
readervar= True | |
ser = serial.Serial(7) #insert COM port number from which data is being collected | |
ser.baudrate = 9600 #insert baud rate | |
while True: | |
if readervar: | |
line= ser.readline() | |
print (line) | |
print(readervar) | |
else if uiplot.btn2.clicked(): | |
break | |
readervar=False | |
def shutter(): | |
readervar=False | |
def main(): | |
global uiplot | |
app = QtGui.QApplication(sys.argv) | |
win_plot = gui_main.QtGui.QMainWindow() | |
uiplot = gui_main.Ui_Form() | |
uiplot.setupUi(win_plot) | |
uiplot.btn1.clicked.connect(reader) | |
uiplot.btn2.clicked.connect(shutter) | |
# DISPLAY WINDOWS | |
win_plot.show() | |
code = app.exec_() | |
sys.exit(code) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment