User Tools

Site Tools

한국어

logicpython:first_program

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
logicpython:first_program [2026/04/10 06:31] mfranklinlogicpython:first_program [2026/04/14 05:16] (current) mfranklin
Line 4: Line 4:
  
 <code python> <code python>
-import time +from time import sleep 
-from cubloc import *+from cubloc import Output, High, Low
  
-led_pin = 25 +# LED on GP25, configured as an output 
-Output(led_pin)+LED = 25 
 +Output(LED)
  
 while True: while True:
-    High(led_pin)+    # Turn LED on for 500ms 
 +    High(LED)
     print("LED ON")     print("LED ON")
-    time.sleep(0.5)+    sleep(0.5)
  
-    Low(led_pin)+    # Turn LED off for 500ms 
 +    Low(LED)
     print("LED OFF")     print("LED OFF")
-    time.sleep(0.5)+    sleep(0.5) 
 </code> </code>
  
 This toggles the onboard LED every 500 ms. This toggles the onboard LED every 500 ms.
  
logicpython/first_program.1775802664.txt.gz · Last modified: by mfranklin