Creative Inspiration Activity Generator
2024-07-19 | By Adafruit Industries
License: See Original Project Displays LCD / TFT Programmers
Courtesy of Adafruit
Guide by Collin Cunningham
Overview
Feeling bored and need something to jumpstart the creative engine?
Sometimes the desire to create just needs a spark – some sort of seed to grow from. This quick, solder-free project turns your Adafruit CLUE into a randomized project generator. It's simple to use and easy to customize by adding your own activities & subjects.
This project takes inspiration from Oblique Strategies, but updates the idea for flexibility and more of an all-ages appeal.
What you'll need
In addition to a computer, you'll need an Adafruit CLUE, USB cable. You can also use a battery to make your CLUE portable.
Optional
What you'll need to do
To get things up & running, this guide will show you how to:
- Install CircuitPython on CLUE
- Install necessary code libraries on CLUE
- Upload project code
Let's get started!
CircuitPython on CLUE
CircuitPython is a derivative of MicroPython designed to simplify experimentation and education on low-cost microcontrollers. It makes it easier than ever to get prototyping by requiring no upfront desktop software downloads. Simply copy and edit files on the CIRCUITPY flash drive to iterate.
The following instructions will show you how to install CircuitPython. If you've already installed CircuitPython but are looking to update it or reinstall it, the same steps work for that as well!
Set up CircuitPython Quick Start!
Follow this quick step-by-step for super-fast Python power :)
Download the latest version of CircuitPython for CLUE from circuitpython.org
Click the link above to download the latest version of CircuitPython for the CLUE.
Download and save it to your desktop (or wherever is handy).
Plug your CLUE into your computer using a known-good USB cable.
A lot of people end up using charge-only USB cables and it is very frustrating! So, make sure you have a USB cable you know is good for data sync.
Double-click the Reset button on the top (magenta arrow) on your board, and you will see the NeoPixel RGB LED (green arrow) turn green. If it turns red, check the USB cable, try another USB port, etc. Note: The little red LED next to the USB connector will pulse red. That's ok!
If double-clicking doesn't work the first time, try again. Sometimes it can take a few tries to get the rhythm right!
You will see a new disk drive appear called CLUEBOOT.
Drag the adafruit-circuitpython-clue-etc.uf2 file to CLUEBOOT.
The LED will flash. Then, the CLUEBOOT drive will disappear, and a new disk drive called CIRCUITPY will appear.
If this is the first time, you're installing CircuitPython or you're doing a completely fresh install after erasing the filesystem, you will have two files - boot_out.txt, and code.py, and one folder - lib on your CIRCUITPY drive.
If CircuitPython was already installed, the files present before reloading CircuitPython should still be present on your CIRCUITPY drive. Loading CircuitPython will not create new files if there was already a CircuitPython filesystem present.
That's it, you're done! :)
Project Code
Now that CircuitPython & libraries are installed on your CLUE, all you need is the project code.
Installing Project Code
To use with CircuitPython, you need to first install a few libraries, into the lib folder on your CIRCUITPY drive. Then you need to update code.py with the example script.
Thankfully, we can do this in one go. In the example below, click the Download Project Bundle button below to download the necessary libraries and the code.py file in a zip file. Extract the contents of the zip file, open the directory Activity_Generator/ and then click on the directory that matches the version of CircuitPython you're using and copy the contents of that directory to your CIRCUITPY drive.
Your CIRCUITPY drive should now look similar to the following image:
# SPDX-FileCopyrightText: 2020 Collin Cunningham for Adafruit Industries
#
# SPDX-License-Identifier: MIT
#
"""ACTIVITY GENERATOR for Adafruit CLUE"""
import time
import random
from adafruit_clue import clue
from things import activities
from things import subjects
screen = clue.simple_text_display(text_scale=4, colors=(clue.WHITE,))
screen[1].text = "ACTIVITY"
screen[2].text = "GENERATOR"
screen.show()
time.sleep(1.5)
screen[0].text = "make a"
screen[2].text = "about"
screen[1].color = clue.RED
screen[3].color = clue.GREEN
screen[4].color = clue.BLUE
activity = "???"
subject_a = "???"
subject_b = "???"
two_subjects = True
def random_pick(items):
index = random.randint(0, len(items)-1)
return items[index]
while True:
if clue.button_a:
activity = random_pick(activities)
subject_a = random_pick(subjects)
subject_b = random_pick(subjects)
time.sleep(0.25)
if clue.button_b:
two_subjects = not two_subjects
time.sleep(0.5)
screen[1].text = activity
screen[3].text = subject_a
if two_subjects:
screen[4].text = subject_b
else:
screen[4].text = ""
screen.show()
Usage & Customization
After booting up, press the A button to generate a new project idea.
If you'd like simpler suggestions, press the B button to remove the second item from the proposed subject.
Generally, the generated project ideas work best as starting points or suggestions. For example: "make a VIDEO about METAL SINGING" could be a video about a heavy metal band, or someone playing the saw, or a crooning fork, etc.
Customize it
You can easily add or remove words used by the generator by editing a single file.
For editing the CircuitPython code, we recommend using the Mu editor. Info for downloading and installing Mu can be found here.
Connect CLUE to your computer and open the CIRCUITPY drive.
Open the file named things.py in the Mu editor.
You can delete or add items to the list, just remember to:
- Indent each item with four spaces
- Enclose each item in quotation marks
- Follow each item with a single comma
- Each item must have a length of 8 characters or less
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum