Added fingerprint support

This commit is contained in:
gocivici 2021-11-09 11:40:38 +02:00
parent 798eb2f15b
commit 9d710f4f9a

View File

@ -5,11 +5,15 @@ from qiskit import QuantumCircuit, execute, Aer, IBMQ
import qiskit as q import qiskit as q
from qiskit.tools.monitor import job_monitor, backend_overview from qiskit.tools.monitor import job_monitor, backend_overview
from qiskit.providers.ibmq import least_busy from qiskit.providers.ibmq import least_busy
import serial
import time import time
#You can add remove or edit prompts from this list. #You can add remove or edit prompts from this list.
DeathList = ["Bees","Sour milk","Cuteness","Monsters from\nthe Deep","In space,\nAlone","In Sleep","Peacefully","Toilet","Furnace","Rollercoaster","Extreme cold","Bear","Heat death of\nthe universe","Goose attack","sneezing","Boat accident"] DeathList = ["Bees","Sour milk","Cuteness","Monsters from\nthe Deep","In space,\nAlone","In Sleep","Peacefully","Toilet","Furnace","Rollercoaster","Extreme cold","Bear","Heat death of\nthe universe","Goose attack","sneezing","Boat accident"]
#open serial communacition to arduino
ser = serial.Serial('/dev/ttyUSB0',9600)
#load account from disk #load account from disk
provider = IBMQ.load_account() provider = IBMQ.load_account()
@ -25,10 +29,17 @@ qc.measure([0, 1, 2, 3],[0, 1, 2, 3])
#Print all avaliable quantum computers #Print all avaliable quantum computers
print("\nAll backends overview:\n") print("\nAll backends overview:\n")
backend_overview() backend_overview()
while True:
#Read serial data coming from the arduino and print it on the console
read_serial=ser.readline().decode('utf-8').rstrip()
print(read_serial)
#execute the program if finger is detected on the sensor
if read_serial == "Image taken":
#find the least busy quantum computer and print it. #find the least busy quantum computer and print it.
backend = least_busy(provider.backends(n_qubits=5, operational=True, simulator=False)) backend = least_busy(provider.backends(n_qubits=5, operational=True, simulator=False))
print("\nLeast busy 5-qubit backend:", backend.name()) print("\nLeast busy 5-qubit backend:", backend.name())
#backend = provider.get_backend('ibmq_belem') #backend = provider.get_backend('ibmq_qasm_simulator')
#number of shots for the quantum computer. We are only throwing the dice once. #number of shots for the quantum computer. We are only throwing the dice once.
shots = 1 shots = 1