Skip to main content
2 of 8
added 13 characters in body

Using Keyboard library for ISO-UK layout

I am creating a keyboard and the PC I use it with is configured for UK so the keyboard layout it expects is this

UK keyboard with UK - Us differences highlighted

This sketch

#include "Keyboard.h"

byte keylist[] = { '`', '2', '3', '\'', '#', '\\' }; 

void setup() {
  Keyboard.begin();
  delay(1000);
  for (byte i = 0; i < sizeof(keylist); i++) {
    Keyboard.press(keylist[i]);
    delay(100);
    Keyboard.release(keylist[i]);
    delay(100);
  }
  Keyboard.press(KEY_RETURN);
  Keyboard.releaseAll();
  for (byte i = 0; i < sizeof(keylist); i++) {
    Keyboard.press(KEY_LEFT_SHIFT);
    Keyboard.press(keylist[i]);
    delay(100);
    Keyboard.releaseAll();
    delay(100);
  }
}

void loop() {
  delay(1000);
}

Creates this output (in a Notepad window)

`23'£#
¬"£@£~ 

I can work around the '#' producing a shift+3 since '\\' produces # but how then do I generate a \?