Editing Circuitpython

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 34: Line 34:
 
To write your program, open code.py and edit it with your code. Once you safe it, it will be automatically excuted. The file name must be code.py or main.py.
 
To write your program, open code.py and edit it with your code. Once you safe it, it will be automatically excuted. The file name must be code.py or main.py.
  
Try it out with the following program. Just use any editor and open code.py. Replace it with the following code and you should see the LED flash. Changes the sleep times. Each time you safe it the new program will be active:
+
Try it out with the following program:
  
 
<syntaxhighlight lang="python" line='line'>
 
<syntaxhighlight lang="python" line='line'>
Line 44: Line 44:
 
led = digitalio.DigitalInOut(board.LED)
 
led = digitalio.DigitalInOut(board.LED)
 
led.direction = digitalio.Direction.OUTPUT
 
led.direction = digitalio.Direction.OUTPUT
 +
 +
print("Hello World!")
 +
i=0
  
 
while True:
 
while True:
 +
    i = i + 1
 +
    print(i)
 
     led.value = False
 
     led.value = False
 
     time.sleep(0.8)
 
     time.sleep(0.8)

Please note that all contributions to Sketching with Hardware at LMU Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see My wiki:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)