Let’s have more fun with the Keyboard object. Upload this sketch and open a word processor or Notepad. Click on the page and then press SW1. The Arno will first type out the alphabet in upper case letters. It then takes advantage of special keyboard characters to replace the upper-case with lower-case letters.

We create an instance of the Keyboard object in the setup() block: Keyboard.begin(); The upper-case letters of the alphabet start with the ASCII number 65 and run through 90. We increment through these letters with a for loop: for(int x = 65; x< 91; x++){ We use the variable aChar to cast x to a char variable. It’s then sent to the PC as if the character was typed on the keyboard. We use a short delay to space out the typing: aChar = x; Keyboard.write(aChar); delay(100); } The lowercase letters in the ASCII table run from 97 to 122. We run through these backwards: for(int x = 122; x > 96; x--){ To replace the uppercase letter, we first send a backspace and then send the new character: Keyboard.write(KEY_BACKSPACE); aChar = x; Keyboard.write(aChar); To position the cursor for the next character, we send a left-arrow key and then move back to the top of the for loop: Keyboard.write(KEY_LEFT_ARROW); delay(100); }