Stray # in program

A shrunk down Leonardo-compatible board, thumb drive sized with native USB support. [Product info]
Post Reply
tacet
Posts: 3
Joined: Tue Feb 09, 2016 9:04 am

Stray # in program

Post by tacet » Tue Feb 09, 2016 9:19 am

Hello all! I am a complete noob to arduino, but I bought a leostick in order to do some penetration testing and I am stumped. I continue to get "stray # in program" with exit status 1 in the error code. Below is the code I am attempting to use (taken from http://www.adebenham.com/2012/05/usb-ru ... oleostick/). I am using a windows machine (windows 7), but I have kali on my laptop if that will ease the process. I know I am just making a noob mistake, but I have been all over the internet trying to find out what I am doing wrong with no success. I have converted the .txt into a .ino file (below), but it fails to either compile or upload in the arduino ide. The com port and board are selected, the sketchbook is located outside the library file (arduino>sketch..), and I have read the getting started and a couple of other how to guides, but with no luck. Any assistance is greatly appreciated. Thanks!

#define KEY_A 0x04 // A key on keyboard, 'a' or 'A'
#define KEY_B 0x05
#define KEY_C 0x06
#define KEY_D 0x07
#define KEY_E 0x08
#define KEY_F 0x09
#define KEY_G 0x0A
#define KEY_H 0x0B
#define KEY_I 0x0C
#define KEY_J 0x0D
#define KEY_K 0x0E
#define KEY_L 0x0F
#define KEY_M 0x10
#define KEY_N 0x11
#define KEY_O 0x12
#define KEY_P 0x13
#define KEY_Q 0x14
#define KEY_R 0x15
#define KEY_S 0x16
#define KEY_T 0x17
#define KEY_U 0x18
#define KEY_V 0x19
#define KEY_W 0x1A
#define KEY_X 0x1B
#define KEY_Y 0x1C
#define KEY_Z 0x1D
#define KEY_1 0x1E // 1 key on keyboard, '1' or '!'
#define KEY_2 0x1F // 2 key on keyboard, '2' or '@'
#define KEY_3 0x20 // 3 key on keyboard, '3' or '#'
#define KEY_4 0x21 // 4 key on keyboard, '4' or '$'
#define KEY_5 0x22 // 5 key on keyboard, '5' or '%'
#define KEY_6 0x23 // 6 key on keyboard, '6' or '^'
#define KEY_7 0x24 // 7 key on keyboard, '7' or '&'
#define KEY_8 0x25 // 8 key on keyboard, '8' or '*'
#define KEY_9 0x26 // 9 key on keyboard, '(' or '('
#define KEY_0 0x27 // 0 key on keyboard, '0' or ')'
#define KEY_ENTER 0x28 // Keyboard Enter key, different from Keypad enter
#define KEY_ESC 0x29 // Escape
#define KEY_BACKSPACE 0x2A // Backspace
#define KEY_TAB 0x2B // Tab
#define KEY_SPACE 0x2C // Spacebar
#define KEY_MINUS 0x2D // Minus key, '-' or '_'
#define KEY_EQUAL 0x2E // Equals key, '=' or '+'
#define KEY_LEFTBRACE 0x2F // Left brace, '[' or '{'
#define KEY_RIGHTBRACE 0x30 // Right brace, ']' or '}'
#define KEY_BACKSLASH 0x31 // Backslash key, '\' or '|'
#define KEY_NONUSHASH 0x32 // Non-US '#' and '~'
#define KEY_SEMICOLON 0x33 // Semicolon key, ';' or ':'
#define KEY_APOSTROPHE 0x34 // Apostrophe key, ''' or double-quotes
#define KEY_GRAVE 0x35 // Grave accent key, '' or '~'
#define KEY_COMMA 0x36 // Comma key, ',' or '<'
#define KEY_DOT 0x37 // Dot key, '.' or '>'
#define KEY_SLASH 0x38 // Forward slash key, '/' or '?'
#define KEY_CAPSLOCK 0x39 // Caps Lock key,
#define KEY_F1 0x3A // Keyboard F1 key
#define KEY_F2 0x3B // Keyboard F2 key
#define KEY_F3 0x3C
#define KEY_F4 0x3D
#define KEY_F5 0x3E
#define KEY_F6 0x3F
#define KEY_F7 0x40
#define KEY_F8 0x41
#define KEY_F9 0x42
#define KEY_F10 0x43
#define KEY_F11 0x44
#define KEY_F12 0x45
#define KEY_SYSRQ 0x46 // PrintScreen Key
#define KEY_SCROLLLOCK 0x47 // Scroll Lock key
#define KEY_PAUSE 0x48 // Pause key
#define KEY_INSERT 0x49 // Insert key
#define KEY_HOME 0x4A // Home key
#define KEY_PAGEUP 0x4B // Page up key
#define KEY_DELETE 0x4C // Delete Forward key
#define KEY_END 0x4D // End key
#define KEY_PAGEDOWN 0x4E // Page down key
#define KEY_RIGHT 0x4F // Right arrow
#define KEY_LEFT 0x50 // Left arrow
#define KEY_DOWN 0x51 // Down arrow
#define KEY_UP 0x52 // Up arrow
#define KEY_NUMLOCK 0x53 // Num Lock and clear
#define KEY_KPSLASH 0x54 // Keypad Forward slash (/)
#define KEY_KPASTERISK 0x55 // Keypad asterisk (*)
#define KEY_KPMINUS 0x56 // Keypad minus (-)
#define KEY_KPPLUS 0x57 // Keypad plus (+)
#define KEY_KPENTER 0x58 // Keypad Enter, different from keyboard enter
#define KEY_KP1 0x59 // Keypad 1 and End
#define KEY_KP2 0x5A // Keypad 2 and Down arrow
#define KEY_KP3 0x5B // Keypad 3 and Page Down
#define KEY_KP4 0x5C // Keypad 4 and Left arrow
#define KEY_KP5 0x5D // Keypad 5
#define KEY_KP6 0x5E // Keypad 6 and Right arrow
#define KEY_KP7 0x5F // Keypad 7 and Home
#define KEY_KP8 0x60 // Keypad 8 and Up arrow
#define KEY_KP9 0x61 // Keypad 9 and Page up
#define KEY_KP0 0x62 // Keypad 0 and Insert
#define KEY_KPDOT 0x63 // Keypad . and Delete
#define KEY_102ND 0x64 // Keyboard Non-US \ and |
#define KEY_COMPOSE 0x65 // Keyboard application, right click-ish 'compose' key
#define KEY_POWER 0x66 // Keyboard Power, not usually a phsyical key
#define KEY_KPEQUAL 0x67 // Keypad =
#define KEY_F13 0x68 // Keyboard F13
#define KEY_F14 0x69
#define KEY_F15 0x6A
#define KEY_F16 0x6B
#define KEY_F17 0x6C
#define KEY_F18 0x6D
#define KEY_F19 0x6E
#define KEY_F20 0x6F
#define KEY_F21 0x70
#define KEY_F22 0x71
#define KEY_F23 0x72
#define KEY_F24 0x73 // Keyboard F24
#define KEY_OPEN 0x74 // Keyboard Execute
#define KEY_HELP 0x75 // Keyboard Help
#define KEY_PROPS 0x76 // Keyboard Menu
#define KEY_FRONT 0x77 // Keyboard Select
#define KEY_STOP 0x78 // Keyboard Stop
#define KEY_AGAIN 0x79 // Keyboard Again
#define KEY_UNDO 0x7A // Keyboard Undo
#define KEY_CUT 0x7B // Keyboard Cut
#define KEY_COPY 0x7C // Keyboard Copy
#define KEY_PASTE 0x7D // Keyboard Paste
#define KEY_FIND 0x7E // Keyboard Find
#define KEY_MUTE 0x7F // Keyboard Mute
#define KEY_VOLUMEUP 0x80 // Keyboard Volume Up
#define KEY_VOLUMEDOWN 0x81 // Keyboard Volume Down
#define KEY_RETURN 0x9E // Keyboard Return
#define KEY_LEFTCTRL 0xE0 // Keyboard Left Control
#define KEY_LEFTSHIFT 0xE1 // Keyboard Left Shift
#define KEY_LEFTALT 0xE2 // Keyboard Left Alt
#define KEY_LEFTGUI 0xE3 // Keyboard Left GUI, windows key
#define KEY_RIGHTCTRL 0xE4 // Keyboard Right control
#define KEY_RIGHTSHIFT 0xE5 // Keyboard Right Shift
#define KEY_RIGHTALT 0xE6 // Keyboard Right alt
#define KEY_RIGHTGUI 0xE7 // Keyboard Right GUI, windows key
#define KEY_PLAYPAUSE 0xE8 // Reserved? ...\/
#define KEY_STOPCD 0xE9
#define KEY_PREVIOUSSONG 0xEA
#define KEY_NEXTSONG 0xEB
#define KEY_EJECTCD 0xEC
#define KEY_WWW 0xF0
#define KEY_BACK 0xF1
#define KEY_FORWARD 0xF2
#define KEY_SCROLLUP 0xF5
#define KEY_SCROLLDOWN 0xF6
#define KEY_EDIT 0xF7

void sendKey(byte key, byte key2, byte modifiers)
{
KeyReport report = {0}; // Create an empty KeyReport

/* First send a report with the keys and modifiers pressed */
report.keys[0] = key; // set the KeyReport to key
report.keys[1] = key2;
report.modifiers = modifiers; // set the KeyReport's modifiers
report.reserved = 1;
Keyboard.sendReport(&report); // send the KeyReport

/* Now we've got to send a report with nothing pressed */
for (int i=0; i<6; i++)
report.keys = 0; // clear out the keys
report.modifiers = 0x00; // clear out the modifires
report.reserved = 0;
Keyboard.sendReport(&report); // send the empty key report
}


void loop(){
}

void setup(){
delay(1000);

sendKey(KEY_#!/BIN/BASH, 0, 0);
sendKey(KEY_INFILE=$1, 0, 0);
sendKey(KEY_OUTFILE=$2, 0, 0);
sendKey(0, 0, 0);
sendKey(KEY_ECHO, KEY_'A', 0);
sendKey(KEY_#DEFINE, KEY_0X05, 0);
sendKey(KEY_#DEFINE, KEY_0X06, 0);
sendKey(KEY_#DEFINE, KEY_0X07, 0);
sendKey(KEY_#DEFINE, KEY_0X08, 0);
sendKey(KEY_#DEFINE, KEY_0X09, 0);
sendKey(KEY_#DEFINE, KEY_0X0A, 0);
sendKey(KEY_#DEFINE, KEY_0X0B, 0);
sendKey(KEY_#DEFINE, KEY_0X0C, 0);
sendKey(KEY_#DEFINE, KEY_0X0D, 0);
sendKey(KEY_#DEFINE, KEY_0X0E, 0);
sendKey(KEY_#DEFINE, KEY_0X0F, 0);
sendKey(KEY_#DEFINE, KEY_0X10, 0);
sendKey(KEY_#DEFINE, KEY_0X11, 0);
sendKey(KEY_#DEFINE, KEY_0X12, 0);
sendKey(KEY_#DEFINE, KEY_0X13, 0);
sendKey(KEY_#DEFINE, KEY_0X14, 0);
sendKey(KEY_#DEFINE, KEY_0X15, 0);
sendKey(KEY_#DEFINE, KEY_0X16, 0);
sendKey(KEY_#DEFINE, KEY_0X17, 0);
sendKey(KEY_#DEFINE, KEY_0X18, 0);
sendKey(KEY_#DEFINE, KEY_0X19, 0);
sendKey(KEY_#DEFINE, KEY_0X1A, 0);
sendKey(KEY_#DEFINE, KEY_0X1B, 0);
sendKey(KEY_#DEFINE, KEY_0X1C, 0);
sendKey(KEY_#DEFINE, KEY_0X1D, 0);
sendKey(KEY_#DEFINE, KEY_'!', 0);
sendKey(KEY_#DEFINE, KEY_'@', 0);
sendKey(KEY_#DEFINE, KEY_'#', 0);
sendKey(KEY_#DEFINE, KEY_'$', 0);
sendKey(KEY_#DEFINE, KEY_'%', 0);
sendKey(KEY_#DEFINE, KEY_'^', 0);
sendKey(KEY_#DEFINE, KEY_'&', 0);
sendKey(KEY_#DEFINE, KEY_'*', 0);
sendKey(KEY_#DEFINE, KEY_'(', 0);
sendKey(KEY_#DEFINE, KEY_')', 0);
sendKey(KEY_#DEFINE, KEY_ENTER, 0);
sendKey(KEY_#DEFINE, KEY_ESCAPE, 0);
sendKey(KEY_#DEFINE, KEY_BACKSPACE, 0);
sendKey(KEY_#DEFINE, KEY_TAB, 0);
sendKey(KEY_#DEFINE, KEY_SPACEBAR, 0);
sendKey(KEY_#DEFINE, KEY_'_', 0);
sendKey(KEY_#DEFINE, KEY_'+', 0);
sendKey(KEY_#DEFINE, KEY_'{', 0);
sendKey(KEY_#DEFINE, KEY_'}', 0);
sendKey(KEY_#DEFINE, KEY_'|', 0);
sendKey(KEY_#DEFINE, KEY_'~', 0);
sendKey(KEY_#DEFINE, KEY_':', 0);
sendKey(KEY_#DEFINE, KEY_DOUBLE-QUOTES, 0);
sendKey(KEY_#DEFINE, KEY_'~', 0);
sendKey(KEY_#DEFINE, KEY_'<', 0);
sendKey(KEY_#DEFINE, KEY_'>', 0);
sendKey(KEY_#DEFINE, KEY_'?', 0);
sendKey(KEY_#DEFINE, KEY_KEY,, 0);
sendKey(KEY_#DEFINE, KEY_KEY, 0);
sendKey(KEY_#DEFINE, KEY_KEY, 0);
sendKey(KEY_#DEFINE, KEY_0X3C, 0);
sendKey(KEY_#DEFINE, KEY_0X3D, 0);
sendKey(KEY_#DEFINE, KEY_0X3E, 0);
sendKey(KEY_#DEFINE, KEY_0X3F, 0);
sendKey(KEY_#DEFINE, KEY_0X40, 0);
sendKey(KEY_#DEFINE, KEY_0X41, 0);
sendKey(KEY_#DEFINE, KEY_0X42, 0);
sendKey(KEY_#DEFINE, KEY_0X43, 0);
sendKey(KEY_#DEFINE, KEY_0X44, 0);
sendKey(KEY_#DEFINE, KEY_0X45, 0);
sendKey(KEY_#DEFINE, KEY_KEY, 0);
sendKey(KEY_#DEFINE, KEY_KEY, 0);
sendKey(KEY_#DEFINE, KEY_KEY, 0);
sendKey(KEY_#DEFINE, KEY_KEY, 0);
sendKey(KEY_#DEFINE, KEY_KEY, 0);
sendKey(KEY_#DEFINE, KEY_KEY, 0);
sendKey(KEY_#DEFINE, KEY_KEY, 0);
sendKey(KEY_#DEFINE, KEY_KEY, 0);
sendKey(KEY_#DEFINE, KEY_KEY, 0);
sendKey(KEY_#DEFINE, KEY_ARROW, 0);
sendKey(KEY_#DEFINE, KEY_ARROW, 0);
sendKey(KEY_#DEFINE, KEY_ARROW, 0);
sendKey(KEY_#DEFINE, KEY_ARROW, 0);
sendKey(KEY_#DEFINE, KEY_CLEAR, 0);
sendKey(KEY_#DEFINE, KEY_(/), 0);
sendKey(KEY_#DEFINE, KEY_(*), 0);
sendKey(KEY_#DEFINE, KEY_(-), 0);
sendKey(KEY_#DEFINE, KEY_(+), 0);
sendKey(KEY_#DEFINE, KEY_ENTER, 0);
sendKey(KEY_#DEFINE, KEY_END, 0);
sendKey(KEY_#DEFINE, KEY_ARROW, 0);
sendKey(KEY_#DEFINE, KEY_DOWN, 0);
sendKey(KEY_#DEFINE, KEY_ARROW, 0);
sendKey(KEY_#DEFINE, KEY_5, 0);
sendKey(KEY_#DEFINE, KEY_ARROW, 0);
sendKey(KEY_#DEFINE, KEY_HOME, 0);
sendKey(KEY_#DEFINE, KEY_ARROW, 0);
sendKey(KEY_#DEFINE, KEY_UP, 0);
sendKey(KEY_#DEFINE, KEY_INSERT, 0);
sendKey(KEY_#DEFINE, KEY_DELETE, 0);
sendKey(KEY_#DEFINE, KEY_|, 0);
sendKey(KEY_#DEFINE, KEY_KEY, 0);
sendKey(KEY_#DEFINE, KEY_KEY, 0);
sendKey(KEY_#DEFINE, KEY_=, 0);
sendKey(KEY_#DEFINE, KEY_F13, 0);
sendKey(KEY_#DEFINE, KEY_0X69, 0);
sendKey(KEY_#DEFINE, KEY_0X6A, 0);
sendKey(KEY_#DEFINE, KEY_0X6B, 0);
sendKey(KEY_#DEFINE, KEY_0X6C, 0);
sendKey(KEY_#DEFINE, KEY_0X6D, 0);
sendKey(KEY_#DEFINE, KEY_0X6E, 0);
sendKey(KEY_#DEFINE, KEY_0X6F, 0);
sendKey(KEY_#DEFINE, KEY_0X70, 0);
sendKey(KEY_#DEFINE, KEY_0X71, 0);
sendKey(KEY_#DEFINE, KEY_0X72, 0);
sendKey(KEY_#DEFINE, KEY_F24, 0);
sendKey(KEY_#DEFINE, KEY_EXECUTE, 0);
sendKey(KEY_#DEFINE, KEY_HELP, 0);
sendKey(KEY_#DEFINE, KEY_MENU, 0);
sendKey(KEY_#DEFINE, KEY_SELECT, 0);
sendKey(KEY_#DEFINE, KEY_STOP, 0);
sendKey(KEY_#DEFINE, KEY_AGAIN, 0);
sendKey(KEY_#DEFINE, KEY_UNDO, 0);
sendKey(KEY_#DEFINE, KEY_CUT, 0);
sendKey(KEY_#DEFINE, KEY_COPY, 0);
sendKey(KEY_#DEFINE, KEY_PASTE, 0);
sendKey(KEY_#DEFINE, KEY_FIND, 0);
sendKey(KEY_#DEFINE, KEY_MUTE, 0);
sendKey(KEY_#DEFINE, KEY_UP, 0);
sendKey(KEY_#DEFINE, KEY_DOWN, 0);
sendKey(KEY_#DEFINE, KEY_RETURN, 0);
sendKey(KEY_#DEFINE, KEY_CONTROL, 0);
sendKey(KEY_#DEFINE, KEY_SHIFT, 0);
sendKey(KEY_#DEFINE, KEY_ALT, 0);
sendKey(KEY_#DEFINE, KEY_KEY, 0);
sendKey(KEY_#DEFINE, KEY_CONTROL, 0);
sendKey(KEY_#DEFINE, KEY_SHIFT, 0);
sendKey(KEY_#DEFINE, KEY_ALT, 0);
sendKey(KEY_#DEFINE, KEY_KEY, 0);
sendKey(KEY_#DEFINE, KEY_...\/, 0);
sendKey(KEY_#DEFINE, KEY_0XE9, 0);
sendKey(KEY_#DEFINE, KEY_0XEA, 0);
sendKey(KEY_#DEFINE, KEY_0XEB, 0);
sendKey(KEY_#DEFINE, KEY_0XEC, 0);
sendKey(KEY_#DEFINE, KEY_0XF0, 0);
sendKey(KEY_#DEFINE, KEY_0XF1, 0);
sendKey(KEY_#DEFINE, KEY_0XF2, 0);
sendKey(KEY_#DEFINE, KEY_0XF5, 0);
sendKey(KEY_#DEFINE, KEY_0XF6, 0);
sendKey(KEY_#DEFINE, KEY_0XF7, 0); //**The errors start here with "a stray # in the program".
sendKey(0, 0, 0);
sendKey(KEY_VOID, KEY_MODIFIERS), 0);
sendKey(KEY_{, 0, 0);
sendKey(KEY_KEYREPORT, KEY_KEYREPORT, 0);
sendKey(0, 0, 0);
sendKey(KEY_/0, KEY_USR/, 0);
sendKey(KEY_REPORT.KEYS[0], KEY_KEY, 0);
sendKey(KEY_REPORT.KEYS[1], KEY_KEY2;, 0);
sendKey(KEY_REPORT.MODIFIERS, KEY_MODIFIERS, 0);
sendKey(KEY_REPORT.RESERVED, KEY_1;, 0);
sendKey(KEY_KEYBOARD.SENDREPORT(&REPORT);, KEY_KEYREPORT, 0);
sendKey(0, 0, 0);
sendKey(KEY_/0, KEY_USR/, 0);
sendKey(KEY_FOR, KEY_I++), 0);
sendKey(KEY_REPORT.KEYS, KEY_KEYS, 0);
sendKey(KEY_REPORT.MODIFIERS, KEY_MODIFIRES, 0);
sendKey(KEY_REPORT.RESERVED, KEY_0;, 0);
sendKey(KEY_KEYBOARD.SENDREPORT(&REPORT);, KEY_REPORT, 0);
sendKey(KEY_}, 0, 0);
sendKey(0, 0, 0);
sendKey(0, 0, 0);
sendKey(KEY_VOID, KEY_LOOP(){, 0);
sendKey(KEY_}, 0, 0);
sendKey(0, 0, 0);
sendKey(KEY_VOID, KEY_SETUP(){, 0);
sendKey(KEY_DELAY(1000);, 0, 0);
sendKey(KEY_", KEY_$OUTFILE, 0);
sendKey(KEY_WHILE, KEY_-R, 0);
sendKey(KEY_DO, 0, 0);
sendKey(KEY_COMMAND=`ECHO, KEY_.*$//G'`, 0);
sendKey(KEY_OPTIONS=`ECHO, KEY_//G'`, 0);
sendKey(KEY_MODIFIERS="0";, 0, 0);
sendKey(KEY_KEY1="0";, 0, 0);
sendKey(KEY_KEY2="0";, 0, 0);
sendKey(0, 0, 0);
sendKey(KEY_IF, KEY_], 0);
sendKey(KEY_THEN, KEY_$OUTFILE, 0);
sendKey(KEY_ELIF, KEY_], 0);
sendKey(KEY_THEN, 0, 0);
sendKey(KEY_OPTIONS=`ECHO, KEY_'S/"/\\\"/G'`, 0);
sendKey(KEY_IFS=", KEY_", 0);
sendKey(KEY_ECHO, KEY_$OUTFILE, 0);
sendKey(KEY_ELIF, KEY_], 0);
sendKey(KEY_THEN, KEY_$OUTFILE, 0);
sendKey(KEY_ELSE, 0, 0);
sendKey(KEY_FOR, KEY_$REPLY, 0);
sendKey(KEY_DO, KEY_KEY="", 0);
sendKey(KEY_IF, KEY_], 0);
sendKey(KEY_THEN, KEY_KEY_MODIFIER_LEFT_GUI";, 0);
sendKey(KEY_ELIF, KEY_], 0);
sendKey(KEY_THEN, KEY_KEY_MODIFIER_LEFT_SHIFT";, 0);
sendKey(KEY_ELIF, KEY_], 0);
sendKey(KEY_THEN, KEY_KEY_MODIFIER_LEFT_ALT";, 0);
sendKey(KEY_ELIF, KEY_], 0);
sendKey(KEY_THEN, KEY_KEY_MODIFIER_LEFT_CTRL";, 0);
sendKey(KEY_ELIF, KEY_], 0);
sendKey(KEY_THEN, KEY_KEY="PROPS", 0);
sendKey(KEY_ELIF, KEY_], 0);
sendKey(KEY_THEN, KEY_KEY="LEFT", 0);
sendKey(KEY_ELIF, KEY_], 0);
sendKey(KEY_THEN, KEY_KEY="RIGHT", 0);
sendKey(KEY_ELIF, KEY_], 0);
sendKey(KEY_THEN, KEY_KEY="UP", 0);
sendKey(KEY_ELIF, KEY_], 0);
sendKey(KEY_THEN, KEY_KEY="DOWN", 0);
sendKey(KEY_ELIF, KEY_], 0);
sendKey(KEY_THEN, KEY_KEY="ESC", 0);
sendKey(KEY_ELSE, KEY_KEY=$TOKEN, 0);
sendKey(KEY_FI, 0, 0);
sendKey(KEY_IF, KEY_], 0);
sendKey(KEY_THEN, KEY_[A-Z]`, 0);
sendKey(KEY_IF, KEY_], 0);
sendKey(KEY_THEN, KEY_KEY1="KEY_$KEY";, 0);
sendKey(KEY_ELSE, KEY_KEY2="KEY_$KEY";, 0);
sendKey(KEY_FI, 0, 0);
sendKey(KEY_FI, 0, 0);
sendKey(KEY_DONE, 0, 0);
sendKey(KEY_ECHO, KEY_$OUTFILE, 0);
sendKey(KEY_FI, 0, 0);
sendKey(KEY_DONE, KEY_$INFILE, 0);
sendKey(0, 0, 0);
sendKey(KEY_ECHO, KEY_$OUTFILE, 0);
sendKey(0, 0, 0);
}

User avatar
stryker
Posts: 267
Joined: Sat Jan 14, 2012 2:44 pm

Re: Stray # in program

Post by stryker » Tue Feb 09, 2016 12:48 pm

Hi,
tacet wrote: sendKey(KEY_#DEFINE, KEY_0XF7, 0); //**The errors start here with "a stray # in the program".
Actually, that's an indication of where the errors end. All those lines with KEY_#DEFINE have the same error.

From the example in the page you linked to, here, there are lots of times that the sendKey() function is called with KEY_ENTER for example as the first parameter.

Code: Select all

sendKey(KEY_ENTER, 0, 0);
That KEY_ENTER is substituted at runtime with the code from the #define earlier in the code

Code: Select all

#define	KEY_ENTER       0x28  // Keyboard Enter key, different from Keypad enter
. There is no KEY_#DEFINE at the top, and presumably that's just shorthand in some documentation somewhere - you need to sub in whatever the key definition is you need from earlier in the code.

From that example you can see that he's getting the leostick to enter gedit, then create a text file, then at the end it hits Alt-Space and then x to exit.

Code: Select all

  sendKey(KEY_SPACE, 0, 0 | KEY_MODIFIER_LEFT_ALT);
  delay(500);
  Keyboard.print("x");
It's not clear from your code what it is you want it to do, but his example is pretty straightforward when you walk though it so you should be able to define what you need. Hope this helps,

Cheers !
Geoff

tacet
Posts: 3
Joined: Tue Feb 09, 2016 9:04 am

Re: Stray # in program

Post by tacet » Wed Feb 10, 2016 2:03 am

Awesome! I will give this a try tonight. Thanks a million!

tacet
Posts: 3
Joined: Tue Feb 09, 2016 9:04 am

Re: Stray # in program

Post by tacet » Wed Feb 10, 2016 4:40 am

OMG...I totally had the wrong idea from the start. Not sure why I was thinking the way I was...but it makes sense now. Thank you for your assistance, Geoff (Styker)! Greatly appreciated!

Post Reply