When you plug in a Gemma M0 running CircuitPython, the DotStar RGB LED on the board pulses green if there's no code.py program to run. If there is a code.py, it shows solid green.

Pulsing green was a little spooky for this nightlight, so I wrote a code.py to run forever:

while True:

That's it, that's the whole nightlight program -- the shortest project code you'll ever see! To use, just copy and save it as code.py on your CIRCUITPY drive.

Then I plugged it in to an AC adapter with a short USB cable, but if you only have a long one, you could  bunch it up with a twist tie.

This simple nightlight was good enough for our houseguests, but let's make a nicer one. Onward!

This guide was first published on Jul 07, 2018. It was last updated on Jul 07, 2018.

This page (Nightlight Basic) was last updated on Aug 16, 2022.

Text editor powered by tinymce.