Using the NeoKey BFF with Arduino involves plugging the breakout into your Arduino-compatible QT Py or Xiao form factor board, installing the Adafruit_NeoPixel library, and running the provided example code.
Wiring
Plug a NeoKey BFF into your QT Py or Xiao form factor board exactly as shown below. Here's an example of connecting a QT Py RP2040 to the BFF.
Connect the QT Py RP2040 with pin headers into the NeoKey BFF with socket headers. They should be plugged in with the backs of the boards facing each other.
For more information on soldering socket headers, check out this Learn Guide.
Library Installation
You can install the Adafruit NeoPixel library for Arduino using the Library Manager in the Arduino IDE.
Click the Manage Libraries ... menu item, search for Adafruit NeoPixel and select the Adafruit NeoPixel library:
// SPDX-FileCopyrightText: 2023 Liz Clark for Adafruit Industries // // SPDX-License-Identifier: MIT // Basic Keyboard Example for NeoKey BFF #include <Keyboard.h> #include <Adafruit_NeoPixel.h> #define LED_PIN A3 #define MX_PIN A2 #define LED_COUNT 1 int mxState = 0; Adafruit_NeoPixel pixel(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800); void setup() { Serial.begin(115200); Keyboard.begin(); delay(5000); pinMode(MX_PIN, INPUT); pixel.begin(); pixel.show(); pixel.setBrightness(50); } void loop() { mxState = digitalRead(MX_PIN); if(mxState == HIGH) { pixel.setPixelColor(0, pixel.Color(150, 0, 0)); pixel.show(); Keyboard.print("Hello World!"); } if(mxState == LOW) { pixel.setPixelColor(0, pixel.Color(0, 0, 0)); pixel.show(); } }
Upload the sketch to your board. When you press the MX key, the text "Hello World!" will be typed. Additionally, the NeoPixel will light-up red. When the key is released, the NeoPixel will turn off.