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.

This code is confirmed to work with a QT Py RP2040. It may not compile as-is with other QT Py or Xiao form factor boards.

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.

Then, plug an MX compatible key into the Kailh socket. 

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:

There are no additional library dependencies for the NeoPixel library.

Example Keyboard Code

// 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.

This guide was first published on Feb 15, 2023. It was last updated on Feb 15, 2023.

This page (Arduino) was last updated on Feb 15, 2023.

Text editor powered by tinymce.