# Import FingerprintSensor class from fingerprint module from fingerprint import FingerprintSensor # Set the serial comport for the connected sensor COM_PORT = "COM7" # /dev/ttyS0" # Create class object fp = FingerprintSensor() # Initialise the sensor serial with the COM port and fixed baud rate of # 115200, set "use_thread" argument as false fp.connect_sensor(port=COM_PORT, baud_rate=9600, use_thread=False) # use remove_all_fingerprints function to remove all the fingerprints # stored in the fingerprint sensor fp.remove_all_fingerprints() # Use read_rx to wait and read the serial input, # print or store the sensor output print(fp.read_rx()) # Disconnect the serial fingerprint sensor fp.disconnect_sensor()
# Import FingerprintSensor class from fingerprint module from fingerprint import FingerprintSensor # Set the serial comport for the connected sensor COM_PORT = "COM7" # /dev/ttyS0" # Create class object fp = FingerprintSensor() # Initialise the sensor serial with the COM port and fixed baud rate of # 115200, set "use_thread" argument as false fp.connect_sensor(port=COM_PORT, baud_rate=115200, use_thread=False) # Use get_device_status function of FingerprintSensor to send the command # to sensor, the sensor will respond with the device state. fp.get_device_status() # print the device state print(fp.read_rx()) # Disconnect the serial fingerprint sensor fp.disconnect_sensor()
"Removed!".format(value)) class LabelButton(object): def __init__(self, master, url=None): self.url = url self.label = tk.Label(master, image=logo, height=40, width=250, bg='white') self.label.place(x=7, y=400) self.label.bind("<Button-1>", self.open_url) def open_url(self, tmp): webbrowser.open(self.url, new=1) robot = None logo = None img = None path = os.path.abspath(os.path.dirname(__file__)) logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG) if __name__ == "__main__": robot = FingerprintSensor() app = MainApp() app.tk.call('wm', 'iconphoto', app._w, img) app.resizable(0, 0) app.mainloop()
# Import FingerprintSensor class from fingerprint module from fingerprint import FingerprintSensor # Set the serial comport for the connected sensor COM_PORT = "COM15" # /dev/ttyS0" # Create class object fp = FingerprintSensor() # Initialise the sensor serial with the COM port and fixed baud rate of # 115200, set "use_thread" argument as false fp.connect_sensor(port=COM_PORT, baud_rate=9600, use_thread=False) # Use register_fingerprint function of FingerprintSensor to send # fingerprint registration command to the sensor fp.register_fingerprint() # Read the sensor output, as the sensor will guide through 3 step # registration process while True: # Read the sensor output, if it's not null print the received data and # follow the steps printed on the console rec = fp.read_rx() if rec: print(rec) # Disconnect the serial fingerprint sensor fp.disconnect_sensor()
# Import FingerprintSensor class from fingerprint module from fingerprint import FingerprintSensor # Set the serial comport for the connected sensor COM_PORT = "COM7" # /dev/ttyS0" # Create class object fp = FingerprintSensor() # Initialise the sensor serial with the COM port and fixed baud rate of # 115200, set "use_thread" argument as false fp.connect_sensor(port=COM_PORT, baud_rate=115200, use_thread=False) # Use the remove_one_fingerprint function of FingerprintSensor class, # and pass the id of the fingerprint you want to remove as the argument fp.remove_one_fingerprint(fp_id=1) # Print the sensor output, to check the success or failure of the command print(fp.read_rx()) # Disconnect the serial fingerprint sensor fp.disconnect_sensor()