def __init__(self): QtGui.QMainWindow.__init__(self) Ui_MainWindow.__init__(self) self.setupUi(self) self.bike = bicycle.Bicycle() self.speedometer = speedometer.Speedometer(self.bike) self.caloriemeter = caloriemeter.Caloriemeter(self.bike) self.rpm_input.editingFinished.connect(self.update_rpms)
def __init__(self, logger, gps, mode='real'): if mode == 'test': print("Powerster]ering is in test mode") super().__init__('PowerSteering', logger) self.logger = logger self.gps = gps port = usb_probe.find_device(robo_config.chias_device) if port == None: print("Can't find serial port for device", robo_config.chias_device) return self.serial = serial.Serial(port, 9600) self.speedometer = speedometer.Speedometer(self.logger) self.speed = 0 self.direction = 0 self.power = 1500 self.steering = 1500 self.start()
def main(): # light show light_show = lights.LightShow() light_show_screen = LightShowScreen(light_show) # speedometer sm = speedometer.Speedometer() speedometer_screen = SpeedometerScreen(sm) # logo screen logo_screen = LogoScreen(light_show) # display unit display_unit = display.ScooterDisplay( [logo_screen, speedometer_screen, light_show_screen]) loop = asyncio.get_event_loop() try: loop.run_forever() except KeyboardInterrupt: print("Interrupted")
import speedometer from tkinter import * root=Tk() canvas=Canvas(root,height=500,width=500) canvas.pack() canvas.create_oval(0,0,500,500,tag="oval") A=speedometer.Speedometer(canvas,"oval",Range=(-500,1000)) A.moveto(-500,"oval") A.changerange(Range=(0,20),rfont=("Verdana",9))
video.set(cv2.CAP_PROP_FRAME_HEIGHT, 200) screen = Canvas(root, height=HEIGHT, width=WIDTH) speedtext = Label(text="0") rpmtext = Label(text='0', fg="black") throttletext = Label(text='0') speedtext.config(font=("Arial", 60)) rpmtext.config(font=("Arial", 60)) throttletext.config(font=("Arial", 40)) speedtext.place(rely=0.9, relx=0.0, anchor='w') rpmtext.place(rely=0.9, relx=1.0, anchor='e') throttletext.place(relx=0.5, rely=0.15, anchor='n') screen.pack() screen.create_oval(30, 30, 300, 300, tag="oval") screen.create_oval(1000, 30, 720, 310, tag="tachoval") A = speedometer.Speedometer(screen, "oval", Range=(40, 0)) B = tachometer.Tachometer(screen, "tachoval", Range=(7000, 0)) #Label for camera spot lmain = Label(root) lmain.place(relx=0.5, rely=0.5, anchor='c') #Week 1 ''' Camera in the center. speedometer on the left below speedometer -> Tachometer Right side - digital number readout left side - engine rpm. lower left - number. upper left - dial right side - miles per hour. Lower right - number. Upper right - dial'''
import speedometer from tkinter import * import time root = Tk() canvas = Canvas(root, height=500, width=500) canvas.pack() canvas.create_oval(0, 0, 500, 500, tag="oval") A = speedometer.Speedometer(canvas, "oval", Range=(0, 40)) for i in range(1000): root.update() time.sleep(0.1) i += 1 A.moveto(i, "oval") A.changerange(Range=(0, 40), rfont=("Verdana", 22)) root.mainloop()
running = False # Enable all debug information obd.logger.setLevel(obd.logging.DEBUG) connection = None speedo = None # Connect to elm327 plug try: connection = obd.OBD() # auto-connects to USB or RF port except: print("Could not connect to ELM327 plug") # Stop logging after connection made obd.logger.removeHandler(obd.console_handler) if connection != None and connection.is_connected() == True: running = True elif mockMode == True: print("Running in MOCK MODE") running = True if running: drive.startDrive() speedo = speedometer.Speedometer() while running == True: speedo.speedoLoop(connection) measureSprint(connection)
# # speedometer_test.py - quick test of the Speedometer class # import logger import speedometer import time my_logger = logger.Logger() my_speedometer = speedometer.Speedometer(my_logger) my_speedometer.start() time.sleep(3) while True: print(my_speedometer.get_values()) time.sleep(1)