MCN 2017 Workshop

Welcome to the workshop. We’ll have lots of fun working with Arduino today.



A quick list of the parts in our kit:

Learn more about the Circuit Playground Classic here. We chose the classic for our class, because the Express does not yet have full support.



Before we use our kits, we need to install some pieces. Sometimes this part can be a bit tricky, depending on your computer. Follow the steps below.

  1. If you have Windows, install the drivers.
  2. Download the Arduino IDE.
  3. Install the Circuit Playground library via the Library Manager. Stop when you get to the section titled “Run the Demo.” We’ll go through those steps together.


Load our First Programs

Together, let’s load our first programs. Follow the steps you saw before to run the demo. Then, load the blink program viaFile >> Examples >> Adafruit Circuit Playground >> Hello_Circuit Playground >> Hello_Blink.


Try Other Programs

Next, try the other Circuit Playground programs that came with the library. File >> Examples >> Adafruit Circuit Playground >> Hello_Circuit Playground >>. See what they do. When you’re finished with those, jump up to some of the others like Birthday_Candles or FidgetSpinner.

See other lessons here.


Wire a Circuit

Now, we’ll break out of the box and build our own circuit using the LED sequins and alligator clips. First, let’s test the LEDs using just power, no code. Follow the diagram below:

Next, let’s use code to control the external LED. Change the circuit, and upload the new code.

#include <Adafruit_CircuitPlayground.h>

int d = 250; // how long to delay in the blink
int ledPin = 6; // which pin is connected to the led?

void setup() {
  pinMode(ledPin, OUTPUT);

void loop() {
  digitalWrite(ledPin, HIGH);
  digitalWrite(ledPin, LOW);


For an advanced code option, combine the blink with a button press.

#include <Adafruit_CircuitPlayground.h>

// learn more about state changes here:

// this constant won't change:
const int  buttonPin = 2;    // the pin that the pushbutton is attached to
const int ledPin = 6;       // the pin that the LED is attached to

// Variables will change:
int buttonPushCounter = 0;   // counter for the number of button presses
int buttonState = 0;         // current state of the button
int lastButtonState = 0;     // previous state of the button

void setup() {
  // initialize the LED as an output:
  pinMode(ledPin, OUTPUT);
  // initialize serial communication:

void loop() {
  // read the pushbutton input pin:
  buttonState = CircuitPlayground.leftButton();

  // compare the buttonState to its previous state
  if (buttonState != lastButtonState) {
    // if the state has changed, increment the counter
    if (buttonState == HIGH) {
      // if the current state is HIGH then the button went from off to on:
      Serial.print("number of button pushes: ");
    } else {
      // if the current state is LOW then the button went from on to off:
    // Delay a little bit to avoid bouncing
  // save the current state as the last state, for next time through the loop
  lastButtonState = buttonState;

  // turns on the LED every four button pushes by checking the modulo of the
  // button push counter. the modulo function gives you the remainder of the
  // division of two numbers:
  if (buttonPushCounter % 2 == 0) {
    digitalWrite(ledPin, HIGH);
  } else {
    digitalWrite(ledPin, LOW);



Remix Programs

Try remixing programs. Maybe try using the capacitive touch sensors.

Here is one where I combined the light sensor and the speaker to make a theremin.

Original idea from Adafruit Arduino - Lesson 10. Pseudo Thermin

#include <Adafruit_CircuitPlayground.h>

int reading; // store light sensor reading
const int minPitch = 200;
const int maxPitch = 6000;

void setup()

void loop()
  // read the light sensor
  reading = CircuitPlayground.lightSensor();

  // calculate a pitch based on the light sensor
  int pitch = map(reading, 0, 1023, minPitch, maxPitch);

  // play a tone
  CircuitPlayground.playTone(pitch, 100, false);



While you’re working on the code, see the following for reference.


Cover photo from Adafruit on Flickr.

Share your thoughts