AgileWhisker Keyboard - a Fully Programmable, Expandable, Open-source Keyboard Designed for Creativity
by KittenBot-Hogan in Circuits > Computers
104 Views, 1 Favorites, 0 Comments
AgileWhisker Keyboard - a Fully Programmable, Expandable, Open-source Keyboard Designed for Creativity
KittenBot’s AgileWhisker Keyboard is a customizable mechanical keyboard that empowers you to unlock new possibilities for PC interactions using DeviceScript. It can be connected to various Jacdac electronic modules, enabling you to build your own unique application modes based on your creativity.
Why AgileWhisker?
We believe the best application of DeviceScript is for PC peripherals. Have you ever imagined being able to control everything around you with the keyboard in front of your computer?
With AgileWhisker, the keyboard and its connected Jacdac functional modules will be further empowered by the Agent desktop software, transforming into dynamic tools that adapt to each user’s unique needs and preferences.
We aim to allow software engineers unfamiliar with hardware development to quickly master the skills of writing interactive effects to meet their personal needs and interests.
Supplies
- AgileWhisker Keyboar
- KittenBot Jacdac Modules
Getting Started With VSCode and DeviceScript
Firstly, we will need to install the necessary DeviceScript extension in VSCode.
Create a Project
Create a new project and open it (or you can also start with our demo project).
Connect the Device
After connecting the keyboard using USB, connect the device in the project.
Quick Start Sample
The flowing colorful lights of a mechanical keyboard are vibrant, but their display modes are limited. With TypeScript editing, we can completely customize a set of flashing combinations that we like. In the following example, we will create a simple RGB that lights up randomly following a key press.
import { KeyboardClient, LedStripLightType, LedVariant, gpio } from "@devicescript/core";
import { startLed } from "@devicescript/drivers";
import { hid2idx } from "./utils/ledmap";
//Init the LED light inside the keyboard
const led = await startLed({
length: 13*5,
columns: 5,
variant: LedVariant.Strip,
hwConfig: { type: LedStripLightType.WS2812B_GRB, pin: gpio(7) },
})
await led.showAll(0) //0:lights off state, set all lights off
//Initialize keyboard
const kb = new KeyboardClient()
//Get pixels buffer
const pixels = await led.buffer()
//Used to store the last lit position
let lastLightNum = 0
//Used to store the last automatic light-off event
let lastClearLight: number = null
//advanced: Function to generate random colors
const getRandomColor = () => {
//Generate random R, G, B component values
const r: number = Math.floor(Math.random() * 256);
const g: number = Math.floor(Math.random() * 256);
const b: number = Math.floor(Math.random() * 256);
//Combines the R, G, and B component values into a 24-bit color value
const color: number = (r << 16) | (g << 8) | b;
return color;
}
//Monitor the key press event, long press will always trigger
kb.down.subscribe(async (key) => {
//hid2idx[key]:The position of the pressed button
if (hid2idx[key]) {
if(lastClearLight && lastLightNum===hid2idx[key]){
//If press and hold the button, the light-off event will be cleared.
clearTimeout(lastClearLight)
}else{
let lastLight = hid2idx[key]
//Set the color of the pressed button to red
pixels.setAt(hid2idx[key], getRandomColor())
// advanced: Set the color to a random color
// pixels.setAt(hid2idx[key], getRandomColor())
await led.show();
}
//Set automatic light-off event
lastClearLight = setTimeout(async()=>{
pixels.setAt(hid2idx[key], 0)
await led.show();
lastClearLight = null
},400)
}
})
Download & Run the Effect
Just click Run to solidify your program effects into the keyboard.
More Interesting
We are crowdfunding on the CrowdSupply , if you are interested please subscribe to us!
Open Source&Community
- Project Website&Learn: https://w.kittenbot.cc (The latest news will be displayed on the website, please stay tuned.)
- Project demo repo: https://github.com/KittenBot/devs-keyboard
- Agent App: https://github.com/KittenBot/agilewhisker-desktop (Provide script services based on JavaScript or Python, or customize functions)