The Adafruit Slide Trinkey is a compact and versatile microcontroller board designed for ease of use and flexibility. It integrates a slide switch, an RGB NeoPixel, and a USB-C connector, making it ideal for a variety of projects that require simple input and colorful output. The board is based on the Adafruit Trinkey platform and supports programming with CircuitPython or Arduino, catering to both beginners and experienced developers. Common applications include USB key peripherals, quick prototyping of user interfaces, and interactive wearable devices.
Pin Number | Description | Notes |
---|---|---|
1 | NeoPixel Data | Connected to GPIO for control |
2 | Slide Switch | Connected to GPIO for input |
3 | GND | Ground |
4 | USB-C VBUS | 5V from USB-C |
5 | Reset | Reset pin (active low) |
To use the Adafruit Slide Trinkey in a circuit, simply plug it into a USB-C port for power and data. The slide switch and NeoPixel are already connected to the microcontroller's GPIO pins, so no additional wiring is necessary for basic operation.
You can program the Slide Trinkey using CircuitPython or Arduino. For CircuitPython, simply drag and drop the .uf2
file onto the Trinkey when it appears as a USB drive. For Arduino, select the appropriate board and port in the Arduino IDE, and upload your sketch.
Below is a simple example of how to control the onboard NeoPixel LED with the slide switch using Arduino.
#include <Adafruit_NeoPixel.h>
#define NEOPIXEL_PIN 1 // Replace with the correct pin number for NeoPixel
#define SWITCH_PIN 2 // Replace with the correct pin number for the slide switch
#define PIXEL_COUNT 1
// Initialize the NeoPixel library.
Adafruit_NeoPixel pixels(PIXEL_COUNT, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pinMode(SWITCH_PIN, INPUT_PULLUP); // Set the switch pin as input with pull-up
pixels.begin(); // Initialize the NeoPixel
}
void loop() {
// Check the switch state
bool switchState = digitalRead(SWITCH_PIN);
if (switchState) {
// If the switch is on, set the NeoPixel to red
pixels.setPixelColor(0, pixels.Color(255, 0, 0));
} else {
// If the switch is off, turn off the NeoPixel
pixels.setPixelColor(0, pixels.Color(0, 0, 0));
}
pixels.show(); // Update the NeoPixel with the new color
}
Q: Can I use the Adafruit Slide Trinkey with a battery? A: The Slide Trinkey is designed to be powered via USB-C. To use a battery, you would need a USB-C battery pack or a power bank.
Q: How do I change the color of the NeoPixel?
A: You can change the color in your code using the pixels.setPixelColor()
function, specifying the red, green, and blue components of the color.
Q: What should I do if my computer doesn't recognize the Trinkey? A: Try using a different USB-C cable, check for obstructions in the USB port, and ensure that the Trinkey is not in bootloader mode. If the issue persists, consult the Adafruit support forums for assistance.