[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 580: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 636: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4511: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3257)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4511: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3257)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4511: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3257)
Protoneer Product Forum • Does the Nano-ARM work as a keyboard?
Page 1 of 1

Does the Nano-ARM work as a keyboard?

Posted: Tue Oct 15, 2019 11:04 pm
by crispin
I'm building a device that sends keyboard presses over USB - would the Nano-ARM work for this? The Arduino Zero seems to have different USB ports for programming it and using it as a keyboard but the Nano-ARM only has the one USB port - does this serve as dual-purpose programming and native or can it only do one?
Thanks.

Re: Does the Nano-ARM work as a keyboard?

Posted: Wed Oct 23, 2019 6:32 pm
by Bertus Kruger
crispin wrote:
Tue Oct 15, 2019 11:04 pm
I'm building a device that sends keyboard presses over USB - would the Nano-ARM work for this? The Arduino Zero seems to have different USB ports for programming it and using it as a keyboard but the Nano-ARM only has the one USB port - does this serve as dual-purpose programming and native or can it only do one?
Thanks.
Can be done...

https://www.arduino.cc/reference/en/lan ... /keyboard/

The NanoArm has a software bootloader where as the Arduino Zero has the standard USB port and a extra USB port for a programmer/debugger

Re: Does the Nano-ARM work as a keyboard?

Posted: Wed Apr 21, 2021 8:27 am
by ericsacchetto
I was trying to accomplish the same goal.
A keypad connected to the NanoARM to send shortcuts to the PC.
Here is the code:

Code: Select all

#include <Keypad.h>
#include "HID-Project.h"


const byte ROWS = 4;
const byte COLS = 4;

char hexaKeys[ROWS][COLS] = {
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'}
};

byte rowPins[ROWS] = {12, 11, 10, 9}; 
byte colPins[COLS] = {8, 7, 6, 5}; 

Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 

void setup(){
  while(!SerialUSB);
  SerialUSB.begin(9600);
  Consumer.begin();

}

void OpenApp(char appAddress)
{
  Keyboard.press(KEY_LEFT_CTRL);
  Keyboard.press(KEY_ESC);
  delay(100);
  Keyboard.releaseAll();
  Keyboard.write('run');
  Keyboard.write(appAddress);
}
  
void loop(){
  char customKey = customKeypad.getKey();
    
  switch (customKey) 
  {
  case '1':
    Consumer.write(MEDIA_PREVIOUS);
    SerialUSB.println("Button 1 pressed");
    break;
  case '2':
    Consumer.write(MEDIA_PLAY_PAUSE);
    SerialUSB.println("Button 2 pressed");
    break;
  case '3':
    Consumer.write(MEDIA_NEXT);
    SerialUSB.println("Button 3 pressed");
    break;
  case 'A':
    OpenApp('C:\Program Files (x86)\Steam\Steam.exe');
    break;
  case '4':
    // statements
    break;
  case '5':
    // statements
    break;
  case '6':
    // statements
    break;
  case 'B':
    // statements
    break;
  case '7':
    // statements
    break;
  case '8':
    // statements
    break;
  case '9':
    // statements
    break;
  case 'C':
    // statements
    break;
  case '*':
    // statements
    break;
  case '0':
    // statements
    break;
  case '#':
    // statements
    break;
  case 'D':
    // statements
    break;
  }
}
I can see the keys being pressed via Serial Monitor but the shortcut is not executed by the PC.
I was wondering if do I need to change the keypad.h and HID-Project.h libraries to use the SerialUSB instead of the Serial function?
Or should I try to use an FTDI module with the NanoARM D0/D1 to provide a new USB to connect to the PC?
Thanks for the help.