Skip to content

Instantly share code, notes, and snippets.

@BenjaminSantiago
Created September 15, 2021 17:23
Show Gist options
  • Save BenjaminSantiago/ca2c765cdc5cd08ccb559bd94413bb47 to your computer and use it in GitHub Desktop.
Save BenjaminSantiago/ca2c765cdc5cd08ccb559bd94413bb47 to your computer and use it in GitHub Desktop.
CPX Red LED blinky light example with comments
"""
This is a multiline comment, you use it to
describe what the program does, or a more
involved piece of code.
You just type 3 quotation marks to start a
multiline comment "block" and then another 3
quotation mark to end the block.
This code turns the red blinky LED (labeled D13)
on then waits, then turns it off, then waits.
That's it.
(Code is originally by Lady Ada, but is super
perfunctory)
"""
# this is a single line comment
# you start it with a octothorpe/hashmark and have to put
# one at the beginning of each line.
# typically you don't use it with a long block of text.
# use them to describe what the next couple of lines do
# or use them to visually separate code.
# import statements
# ----------------------------
import time
from adafruit_circuitplayground import cp
# ----------------------------
# main loop
# ----------------------------
while True:
# turn LED on
cp.red_led = True
# wait a bit
time.sleep(0.5)
# turn LED off
cp.red_led = False
# wait a bit
time.sleep(0.5)
# ----------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment