Jan-11-2018, 04:35 AM
while True: Signal=mcp.read_adc(adc_number) # The read_adc function will get the value of the specified channel and the Signal will hold the incoming raw digital data if(Signal>thresh) and (i<=5): if i==0: time1=int(time.time()*1000) c=c+1 i=i+1 time2=int(time.time()*1000) t=time2-time1 rate=t/5 rate=60000/rate print(rate) # BPM time.sleep(0.005)I wrote this program for measuring the beats/minute(BPM) from a pulse sensor. This code shows an error like time2 and time1 not defined. Is this code correct for finding the BPM value from pulse sensor?