/Capslock-warning

Why in the world is capslock led so tiny?!? Here is a minimal project to get a capslock-notifier as big as you want!

Primary LanguageC++Apache License 2.0Apache-2.0

Capslock-warning

Why in the world is capslock led so tiny?!? Here is a minimal project to get a capslock-notifier as big as you want!

Without capslock-warning

image

With capslock warning :-)

image

You can use any container you like for the caps-lock led:

image

image

image

Just puth the led inside it and connect it to pin 17 of Arduino Micro (or any Arduino equipped with ATmega32u4)

The code

#include "HID-Project.h"

const int statusLed = 17; // "alive" status LED
const int warningLed = 3;

void setup() {
  pinMode(statusLed, OUTPUT);
  pinMode(warningLed, OUTPUT);

  // Sends a clean report to the host. This is important on any Arduino type.
  BootKeyboard.begin();
}


void loop() {
  digitalWrite(statusLed, HIGH); // Inform user that loop is running
  if (BootKeyboard.getLeds() & LED_CAPS_LOCK) {
    digitalWrite(warningLed, HIGH);
  } else {
    digitalWrite(warningLed, LOW);
  }
}

That's all.

(See reference code)

Dependencies

This project relies on various libraries, depending on the board:

  • Arduino Pro Micro: HID library by NicoHood, you need to install it in Arduino IDE (minimum 1.6.7) before compiling the project.
  • ESP32:
  • Waveshare RP2040 zero: keyboard.h (pre-included in IDE?)
  • All: Adafruit Neopixel (for RGB LED control).

The hardware

image

Tested

With some hacking:

  • Uno (requires HoodLoader2)
  • Mega (requires HoodLoader2)

To be tested

How it works

Keyboard is not just an input device, it's also an output device! You can verify it by yourself: if you connect two keyboards to same PC, upon enabling CAPSLOCK on one keyboard, the CAPSLOCK on the other keyboard will light up!

This sketch enables the Arduino board to behave like a keyboard, receiving input from the "actual" keyboard connected to the PC: upon detecting CAPSLOCK press, it lights up a big led which you can't miss.

Serial communication

Some of the sketches support setting up led color using command R,G,B from serial (ex: 0,0,255 will set led to blue). Usa free+portable Tera Term for Windows.