21 lines
464 B
Python
21 lines
464 B
Python
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: ")
|
|
|