Это старая версия документа!


Exp19.py
  1. from machine import Pin
  2. import time
  3. _init()
  4.  
  5. LedPin = 16
  6. led = Pin(LedPin, Pin.OUT)
  7.  
  8. adc = machine.ADC(0)
  9.  
  10. while True:
  11. value = adc.read()
  12. if value > 400:
  13. led.on()
  14. else:
  15. led.off()
  16. print(value)
  17. time.sleep(1)