UBISS2024exam: Difference between revisions

From Sketching with Hardware at LMU Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
<syntaxhighlight lang="python" line='line'>import time
<syntaxhighlight lang="python" line='line'>import time
from machine import Pin
from machine import Pin, ADC
x = Pin(6, Pin.OUT)
from time import sleep
while (True):
 
  x.on()
y = ADC(Pin(26))
  time.sleep_ms(500)
 
  x.off()
while True:
  time.sleep_ms(100)
  z = y.read_u16()
  print(z)
  sleep(1)
</syntaxhighlight>
</syntaxhighlight>

Revision as of 12:57, 13 June 2024

import time
from machine import Pin, ADC
from time import sleep

y = ADC(Pin(26))

while True:
  z = y.read_u16()
  print(z)
  sleep(1)