diff --git a/adc-svetloba.py b/adc-svetloba.py new file mode 100644 index 0000000..3d9d445 --- /dev/null +++ b/adc-svetloba.py @@ -0,0 +1,20 @@ +from machine import ADC, Pin +import time +import math +adc=ADC(0) +tipka=Pin(12, Pin.IN, Pin.PULL_UP) +led=Pin(15, Pin.OUT) +#def korigiraj(x): + #popravi svetlobno lestvico iz nelinearnega adc + # v vsaj približno linearne lukse + +while tipka.value(): + svetlost=adc.read() + if svetlost<512: + led.value(1) + else: + led.value(0) + time.sleep_ms(500) + print("realni izhod: ", svetlost) + #print("korigirana vrednost: ") +