# Keybow sends "c" instead of RIGHT\_ALT (and other glitches)

**URL:** https://forums.pimoroni.com/t/keybow-sends-c-instead-of-right-alt-and-other-glitches/10076
**Category:** Support
**Created:** [March 6, 2019, 5:42pm UTC](https://forums.pimoroni.com/t/keybow-sends-c-instead-of-right-alt-and-other-glitches/10076 "2019-03-06T17:42:17Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![ghalfacree](https://avatars.discourse-cdn.com/v4/letter/g/82dd89/32.png) [@ghalfacree](https://forums.pimoroni.com/u/ghalfacree)
#### Post date: [March 6, 2019, 5:42pm UTC](https://forums.pimoroni.com/t/keybow-sends-c-instead-of-right-alt-and-other-glitches/10076/1 "2019-03-06T17:42:18Z")

</div>

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:

```auto
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.

```auto
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:

```auto
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…

```auto
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.

```auto
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:

```auto
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:

````auto
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
```
````

---

<div class="post-metadata">

### Author: ![ghalfacree](https://avatars.discourse-cdn.com/v4/letter/g/82dd89/32.png) [@ghalfacree](https://forums.pimoroni.com/u/ghalfacree)
#### Post date: [March 13, 2019, 3:33pm UTC](https://forums.pimoroni.com/t/keybow-sends-c-instead-of-right-alt-and-other-glitches/10076/2 "2019-03-13T15:33:53Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Matt](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/matt/32/1006_2.png) [@Matt](https://forums.pimoroni.com/u/Matt)
#### Post date: [March 14, 2019, 9:11am UTC](https://forums.pimoroni.com/t/keybow-sends-c-instead-of-right-alt-and-other-glitches/10076/3 "2019-03-14T09:11:24Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Niallio](https://avatars.discourse-cdn.com/v4/letter/n/76d3ee/32.png) [@Niallio](https://forums.pimoroni.com/u/Niallio)
#### Post date: [April 5, 2019, 2:57pm UTC](https://forums.pimoroni.com/t/keybow-sends-c-instead-of-right-alt-and-other-glitches/10076/4 "2019-04-05T14:57:23Z")

</div>

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…?

---

<div class="post-metadata">

### Author: ![ghalfacree](https://avatars.discourse-cdn.com/v4/letter/g/82dd89/32.png) [@ghalfacree](https://forums.pimoroni.com/u/ghalfacree)
#### Post date: [May 8, 2019, 8:18pm UTC](https://forums.pimoroni.com/t/keybow-sends-c-instead-of-right-alt-and-other-glitches/10076/5 "2019-05-08T20:18:24Z")

</div>

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.)

---

<div class="post-metadata">

### Author: ![mikedpoole](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@mikedpoole](https://forums.pimoroni.com/u/mikedpoole)
#### Post date: [May 23, 2019, 2:14pm UTC](https://forums.pimoroni.com/t/keybow-sends-c-instead-of-right-alt-and-other-glitches/10076/6 "2019-05-23T14:14:49Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Jerry](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/jerry/32/5455_2.png) [@Jerry](https://forums.pimoroni.com/u/Jerry)
#### Post date: [May 23, 2019, 6:43pm UTC](https://forums.pimoroni.com/t/keybow-sends-c-instead-of-right-alt-and-other-glitches/10076/7 "2019-05-23T18:43:24Z")

</div>

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
```

---

<div class="post-metadata">

### Author: ![mikedpoole](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@mikedpoole](https://forums.pimoroni.com/u/mikedpoole)
#### Post date: [May 23, 2019, 11:59pm UTC](https://forums.pimoroni.com/t/keybow-sends-c-instead-of-right-alt-and-other-glitches/10076/8 "2019-05-23T23:59:31Z")

</div>

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.
