Difference between revisions of "UBISS2024exam"

From Sketching with Hardware at LMU Wiki
Jump to navigation Jump to search
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

 1 import time
 2 from machine import Pin, ADC
 3 from time import sleep
 4 
 5 y = ADC(Pin(26))
 6 
 7 while True:
 8   z = y.read_u16()
 9   print(z)
10   sleep(1)