mirror of
https://github.com/brendanhaines/ECEN5458_Project.git
synced 2024-11-09 21:14:47 -07:00
add calibration stuff
This commit is contained in:
parent
9316389b71
commit
f2fd61181a
|
@ -31,8 +31,20 @@ if __name__ == "__main__":
|
||||||
io.value = mux[ii]
|
io.value = mux[ii]
|
||||||
return adc_mux.voltage
|
return adc_mux.voltage
|
||||||
|
|
||||||
|
input("White calibration, press ENTER to continue...")
|
||||||
|
white_cal = [get_reflectivity(c) for c in range(8)]
|
||||||
|
|
||||||
|
input("Black calibration, press ENTER to continue...")
|
||||||
|
black_cal = [get_reflectivity(c) for c in range(8)]
|
||||||
|
|
||||||
|
def get_normalized_reflectivity(chan):
|
||||||
|
global white_cal
|
||||||
|
global black_cal
|
||||||
|
|
||||||
|
return (get_reflectivity(chan) - black_cal) / (white_cal - black_cal)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
for ii in range(1):
|
for ii in range(8):
|
||||||
print(f"{get_reflectivity(ii):1.2f}\t", end="")
|
print(f"{get_reflectivity(ii):1.2f}\t", end="")
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user