CircuitPython is a programming language designed to simplify experimenting and learning to program on low-cost microcontroller boards. It makes getting started easier than ever with no upfront desktop downloads needed. Once you get your board set up, open any text editor, and get started editing code.
Aug 12, 2017 · Introducing "Hello, World!" The simplest program in Python consists of a line that tells the computer a command. Traditionally, the first program of every programmer in every new language prints "Hello, World!"
The first line inside our while True: loop is the same as the first line of our last program. We're turning on the red LED with cpx.red_led = True. Next, we have time.sleep (0.5). This tells the code to pause in the current state for 0.5 seconds.
I've got a CircuitPython hang that I've seen on 4.1.0 rc0 and rc1 if I leave some code running. Takes about ten minutes on a PyGamer to hang, it's not predictable but will do it on about one in four executions.
While we can get microcontrollers with RTCs built in, and as add-on boards (Adafruit has several in their shop that have CircuitPython support), they are typically reserved for applications where "clock time" is necessary - for example, a digital alarm clock, or logging sensor data.
MicroPython and CircuitPython bring the ease of Python to microcontrollers by adding hardware support! In MicroPython, Python is largely unchanged other than the added functionality to interface with hardware. CircuitPython is a derivative of MicroPython that changes a few things to make the language easier to learn and use.
A for-loop or while-loop is meant to iterate until the condition given fails. When you use a break or continue statement, the flow of the loop is changed from its normal way. A break statement, when used inside the loop, will terminate the loop and exit. If used inside nested loops, it will break out from the current loop.