2

I have created a retro keyobard using a ZX spectrum and a PRO MICRO based on the info here: http://blog.tynemouthsoftware.co.uk/2013/04/arduino-leonardo-based-zx81-usb-keyboard.html

When plugged into my laptop or a raspberry PI it works fine. However, when running any of the emulators like FUSE it doesn't work at all.

Can anyone explain why this is and what I have to do to make it work? Searching around on the web I see it has something to do with the key mapping which I can understand for when I do shifted keys but why it doesn't work when I just press p is eluding me.

EDIT: When using a USB sniffing program I can see that my "real" keyboard sends 0x8 bytes for an 'a' 00 00 04 00 00 00 00 00

BUT my arduino sends 0x9 for an 'a' 02 00 00 04 00 00 00 00 00

Snippets of the the code I am using is

// keyMap and keyMapShifted are both 2D arrays of type byte
byte keyMap[8][5] = { {'5', '4', '3', '2', '1' ....etc
byte key = shifted ? keyMapShifted[[r][c] : keyMap[r][c]
Keyboard.write(key)  

Ideas? A Bug? Do I have to rewrite Keyboard.write?

  • 1
    Does a normal USB keyboard work with these emulators? If not, then the question is off-topic here and belongs a support site for the emulator. But if a usual USB keyboard does work, then the reasons why yours doesn't seems on-topic, and you should probably start by trying to use logging software to see the key codes it sends vs the ones your implementation sends. – Chris Stratton Aug 28 '14 at 14:43
  • Yes the normal keyboard works 100%. OK I will have a look at finding some logging software. Thanks! – Gavin Aug 29 '14 at 10:11
  • OK using a USB sniffing program I can see that mky "real" keyboard send 0x8 bytes for an 'a' 00 00 04 00 00 00 00 00 – Gavin Aug 29 '14 at 11:56
  • BUT my arduino sends 0x9 for an 'a' 02 00 00 04 00 00 00 00 00 The code I am using is Keyboard.write(key) where key is of type byte and is assigned by byte key = shifted ? keyMapShifted[[r][c] : keyMap[r][c]. keyMap and keyMapShifted are both 2D arrays of type byte initialised by (for example) byte keyMap[8][5] = { {'5', '4', '3', '2', '1' ....etc – Gavin Aug 29 '14 at 11:57
  • 1
    Edit this into your question, don't try to squeeze it into comments – Chris Stratton Aug 29 '14 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.