*********************************** RAPasc(nn,cvrsFactor) (text) *********************************** #By D@CC #On 2024BFeb29 #Article: 180.html #uSD: Fla53S # RAPasc protocol means # 100 complex Readings from pico ADC nn with Periods in 7 bit asc (ascii) # see article 150 by D@CC for RAPasc # Purpose to return converted value of ADC0 # in a special format of a complex number where # the real part is the converted voltage # and the imaginary part is the UNIX time of the reading # see Article 165 MAK Pi ADC # version A works fine (it now has high input impedance as of 2022FJun09) # A is used with a 10K0 and a 100k0 resistor to read 9% of actual voltage. # This ensures that the ADC max input voltage is not exceeded. # if nn=1: # returns value of ADCnn * cvrsFactor # plus dt as imaginary value # if conversion factor ==1 then # real component is returned as a hex value # if nn==0: # returns value of ADC0 * (reading * cvrsFactor * ixProbe) ixProbe=9 #ixProbe attenuation is 9 timeNow=time.time() strTime=str(timeNow)+".000" if nn==0: #nn is 0 #ADC0 strN0="0" strReading=str(readADC_pico(0)*ixProbe) print("|"+strReading+"|") strReading=strReading.strip() RAPreading="ADC"+strN0+":("+strReading+"+"+strTime+"j)" print(RAPreading) #if end return RAPreading #/RAPasc.py