Let's start with A0 which is in the bottom right corner, and work our way counter-clockwise
A0 (a.k.a D12) - This is a special pin that can do true analog output so it's great for playing audio clips. In can be digital I/O, or analog I/O, but if you do that it will interfere with the built-in speaker. This is the one pin that cannot be used for capacitive touch.
A1 / D6 - This pin can be digital I/O, or analog Input. This pin has PWM output and can be capacitive touch sensor
A2 / D9 - This pin can be digital I/O, or analog Input. This pin has PWM output and can be capacitive touch sensor
A3 / D10 - This pin can be digital I/O, or analog Input. This pin has PWM output and can be capacitive touch sensor
A4 / D3 - This pin can be digital I/O, or analog Input. This pin is also the I2C SCL pin, and can be capacitive touch sensor
A5 / D2 - This pin can be digital I/O, or analog Input. This pin is also the I2C SDA pin, and can be capacitive touch sensor
A6 / D0 - This pin can be digital I/O, or analog Input. This pin has PWM output, Serial Receive, and can be capacitive touch sensor
A7 / D1 - This pin can be digital I/O, or analog Input. This pin has PWM output, Serial Transmit, and can be capacitive touch sensor
The google drive folder (to the right) has all the Arduino sketches.
An LED requires the long (positive) leg to be attached to a positive power source, and the short (negative) leg to be attached to negative to complete the circuit.
On the Circuit Playground, we can control digital pins connecting to the positive power source of the board; there are pins for ground (GND) that are always connected to the "negative" for completing circuits.
To wire the Circuit Playground with an external LED, we will connect
the short (negative) leg to a ground GND pin
the long (positive) leg to a digital pin
many of the pins on a Circuit Playground can be controlled as a digital or analog pin, so they end up having dual names
in the sample sketch, we'll use digital pin 3, which is also analog pin A4 (and that is the the label you'll see on the physical board)
To make a better connection for the LED onto the paper circuit:
Use needle nose pliers to curl the LED leads.
Be sure you know which one is positive and which is negative!
Then, rest the LED on copper tape and use a small piece to "sandwich" the curled leads and make a decent connection.
Here's another example that shows how to connect two LEDs (in parallel).
Sample sketch - external LEDs
Adapt the Sample Blink code to use one of the external pins. Here, we'll use the digital pin 3 (labeled A4 for Analaog 4 on the CPE board).
/*
Adapted from Examples -> Basics -> Blink
Turns an LED on for one second, then off for one second, repeatedly.
*/
int LED_PIN = 3; // choose to control (digital) pin 3
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_PIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_PIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_PIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
You may need to play with the threshold value. If it's too low, then it will be very sensitive; sometimes just attaching an alligator clip will count as a "touch." In this case, use the Serial monitor to determine a better threshold value.
CPBlinkAllNeoPixels
blinks all the onboard neopixels
CPBlinkNeoPixel
blinks a single neopixel (set the index value using the variable neopixel at the top)
CPCapLights
Allows capacitive touch to the 7 pads on the CPE and lights the closest onboard neopixel in response
See below for how to extend the touch to copper tape
CPCapPiano
Allows capacitive touch to the 7 pads on the CPE and plays a note in response using the onboard Piezo buzzer
CPColorLightExternal
Adapts CPColorMatch to light an external LED (or fairy light strand) in response to matching the color red
Attach the external LED/fairy light to pin A1
CPColorMatch
Senses color and matches it to the closest color in an array.
When modifying the colors to try to match to, you need to use the:
colorValues for RGB triples
numColors for the length of the array/number of colors
colorNames to hold corresponding color names
CPColorSpeak
Adapts the Color match to sense red, green and yellow (or no match)
Speaks "The color is red/green/yellow" upon finding a matching color.
CPLightSensor
Turns an external LED on when there is low light
CPMicroServoSweep
Controls an external microservo
See below for more info
CPPianoNotes
Upon turning on, plays a scale of notes
CPSoundBeatsLights
All onboard neopixels turn on in response to (loud) sounds
CPsoundLED
Onboard neopixels turn on in response to sounds - more lights with louder sounds
Micro Servo 9g SG90 (in Elegoo kits)
Load the CPESweep code onto the CPE.
Unplug EVERYTHING!
Attach your wires from the Servo to the CPE:
GND to GND (brown in the image)
Voltage to 3.3V (red in the image)
PWM control to A1 (orange in the image)
Double-check your connections and make sure no metal is touching other metal that you don't want!
Plug in the CPE to power (via USB or external battery)
You should see the motor sweep back and forth now!