def __init__(self, comport, displayTime=2): global SENSOR_DATA_BUFFER_LENGTH #input is the maxDisplayTime in seconds self.numSensors = 0 self.board = seismicpi.SeismicPi(comport) SENSOR_DATA_BUFFER_LENGTH = displayTime * 1000 self.qx = deque(maxlen=SENSOR_DATA_BUFFER_LENGTH) self.app = QtGui.QApplication([]) self.win = pg.GraphicsWindow(title="Sensor Plots") self.win.resize(1000, 800) self.renderLock = False self.read_sensors = False self.read_accel = False self.pen_colors = ['r', 'g', 'b', 'y'] self.sensors = [] self.paused = False pg.setConfigOptions(antialias=False)
import sys from PyQt4 import QtCore, QtGui, uic import seismicpi import time import configParse import datetime if len(sys.argv)<2: print "Usage: " + sys.argv[0] + " <port_name>" sys.exit(1) board = seismicpi.SeismicPi(sys.argv[1]) form_class = uic.loadUiType("Settings.ui")[0] class MyWidget(QtGui.QMainWindow, form_class): def __init__(self, parent = None): QtGui.QMainWindow.__init__(self, parent) self.setupUi(self) self.initialize_card_button.clicked.connect(self.initialize_handle) self.logging_button.clicked.connect(self.logging_handle) self.schedule_button.clicked.connect(self.schedule_button_handle) self.save_setting_button.clicked.connect(self.save_setting_handle) self.file_save_button.clicked.connect(self.file_save_handle) self.file_load_button.clicked.connect(self.file_load_handle) self.start_time.setDateTime(datetime.datetime.now()) self.end_time.setDateTime(datetime.datetime.now()) self.start_time.setEnabled(False)
def __init__(self, portname): self.board = seismicpi.SeismicPi(portname) self.running = False
import seismicpi import time import datetime import calendar import sys if len(sys.argv) < 2: print "Usage: " + sys.argv[0] + " <port_name>" sys.exit(1) sp = seismicpi.SeismicPi(sys.argv[1]) print "Board version:", sp.get_firmware_string() print "Sensor 1 name:", sp.get_sensor_name(1) print "Sensor 2 name:", sp.get_sensor_name(2) print "Sensor 3 name:", sp.get_sensor_name(3) print "Sensor 4 name:", sp.get_sensor_name(4) print "Sample rate:", sp.get_sample_rate() print "File type:", sp.get_file_format() print "Sensor 1 enabled:", sp.is_sensor_enabled(1) print "Sensor 2 enabled:", sp.is_sensor_enabled(2) print "Sensor 3 enabled:", sp.is_sensor_enabled(3) print "Sensor 4 enabled:", sp.is_sensor_enabled(4) print "Accelerometer X enabled:", sp.is_sensor_enabled(5) print "Accelerometer Y enabled:", sp.is_sensor_enabled(6) print "Accelerometer Z enabled:", sp.is_sensor_enabled(7)