Keybow sends "c" instead of RIGHT_ALT (and other glitches)

I’m perfectly willing to assume that I’m doing something bone-headed, here, but I can’t figure what.

The Keybow’s working fine, but my attempt at creating my own layout isn’t going so well. I’ve set up keys for F11, F12, and the cursor arrows, and that’s all working a treat.

The first thing that isn’t working is this:

function handle_key_02(pressed)
    keybow.set_key(keybow.RIGHT_ALT, pressed)
end

Now, I was expecting that to act as an Alt. Gr. key - which my main keyboard lacks - but what it actually does is type the letter c. Just c. Nothing else. If I hold it down, it repeats the letter c. At no point does it act like an Alt. modifier, Gr. or otherwise.

The next problem I’m having: symbol handling.

function handle_key_08(pressed)
    keybow.set_key("°", pressed)
end

I figured that would give me a degree symbol, but it doesn’t: nothing happens. Fair enough, a degree symbol isn’t a single key on a keyboard, so let’s enter it as text:

function handle_key_06(pressed)
    keybow.text("°", pressed)
end

No change: pressing the key still doesn’t do anything. So, wait, the examples in the documentation don’t have “pressed” on the end…

function handle_key_06(pressed)
    keybow.text("°")
end

Still nothing. Okay, let’s give up on that - and the bindings I attempted for € and ¥ - and try a text snippet.

function handle_key_11(pressed)
    keybow.text("Please find attached my invoice for work carried out on ", pressed)
end

That kinda-sorta works, except it occasionally drops a character or two - never the same character - and it prints it once on key-down and once on key-up. So, let’s try removing the “pressed” again:

function handle_key_11(pressed)
    keybow.text("Please find attached my invoice for work carried out on ")
end

No change. Neither is there if I put not pressed at the end instead. It always prints twice, once on key-down and once on key-up.

Any assistance is much appreciated - as I say, I’m perfectly willing to assume it’s me being boneheaded, but I can’t figure out how to get these working!

Full Lua file below:

require "keybow"

-- Extensions for the IBM Model F's missing keys. --

-- Key mappings --

function handle_key_00(pressed)
    keybow.set_key(keybow.F11, pressed)
end

function handle_key_01(pressed)
    keybow.set_key(keybow.F12, pressed)
end

function handle_key_02(pressed)
    keybow.set_key(keybow.RIGHT_ALT, pressed)
end

function handle_key_03(pressed)
    keybow.set_key(keybow.LEFT_ARROW, pressed)
end

function handle_key_04(pressed)
    keybow.set_key(keybow.DOWN_ARROW, pressed)
end

function handle_key_05(pressed)
    keybow.set_key(keybow.RIGHT_ARROW, pressed)
end

function handle_key_06(pressed)
    keybow.text("°")
end

function handle_key_07(pressed)
    keybow.set_key(keybow.UP_ARROW, pressed)
end

function handle_key_08(pressed)
    keybow.set_key("^", pressed)
end

function handle_key_09(pressed)
    keybow.text("€")
end

function handle_key_10(pressed)
    keybow.text("¥")
end

function handle_key_11(pressed)
    keybow.text("Please find attached my invoice for work carried out on ", not pressed)
end
```

Anybody any clues that might point me in the right direction, here?

I’m wondering if it might be worth downloading the image again, and flashing that - perhaps even to a different SD card, just to see if that helps.

Regarding the degree symbol, surely the text function is simply sending a sequence of keystrokes, and if the degree symbol isn’t available as a single keypress, it surely wouldn’t be any better off in a sequence…?

Finally found time to try this out again. Wiped a clean, known-good microSD. Downloaded the ZIP archive fresh. Extracted the contents of the sdcard directory to the known-good microSD. Booted it, verified that the default number pad layout works. Unplugged it, put in the Lua file from my original post, configured it to load that instead, ejected, put it into the Keybow, booted and…

No difference. The macro still prints twice; the degree, Euro, and Yen symbols don’t print at all; and keybow.RIGHT_ALT just sends the letter ‘c’.

EDIT:
To add to this, I just tried modifying the boilerplate.lua file instead of creating my own. That fixes the “Please find attached …” macro, which now prints only once - but it still fails to print any of the symbols (or RIGHT_ALT.)

I have a similar problem to your ALT_RIGHT problem in Ubuntu with a lazy way of opening Password Gorilla. “keybow.set_key(keybow.LEFT_META, pressed)” doesn’t work but if I do that on the keyboard myself and press key 9 on the Keybow, the rest of the code works, There must be something we’re doing wrong with the syntax.

The indenting below obviously isn’t correct – I’m new to posting comments and can’t work out how to show the indents properly!

function handle_key_09(pressed)
if pressed then
keybow.set_key(keybow.LEFT_META, pressed)
keybow.sleep(500)
keybow.text(“Password Gorilla”)
keybow.sleep(500)
keybow.tap_enter()
keybow.sleep(500)
keybow.text(“XXXXXX”)
keybow.tap_enter()
end
end

I wouldn’t worry overly about intents, they’re good for showing the structure of code and to make it easier to read. Unlike Python however, LUA is a language that doesn’t care about whitespace, so long as you don’t try and put a space in a function name.

So

if something
    then this 
else
    this

is treated the same as

if something
then this
else
this
1 Like

Oh, thanks—good to know. I have very much to learn. Still trying to work out why the meta key isn’t pressed but hopefully I’ll get there.