Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: Error compiling code for Teensylc on Arduino 1.8.9

  1. #1
    Junior Member
    Join Date
    Apr 2019
    Posts
    1

    Error compiling code for Teensylc on Arduino 1.8.9

    i am trying to compile some code i found online for a project i am making and i am running into this compiling error and i dont know how to fix it as im not experienced in using arduinos at all

    This is the error message:

    Arduino: 1.8.9 (Windows 10), TD: 1.46, Board: "Teensy LC, Serial, 48 MHz, Smallest Code, US English"

    GamePi_2_teensy_LC: In function 'void loop()':
    GamePi_2_teensy_LC:104: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_Up.fallingEdge() ) { Joystick.button( 1, 1); }

    ^

    GamePi_2_teensy_LC:105: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_Down.fallingEdge() ) { Joystick.button( 2, 1); }

    ^

    GamePi_2_teensy_LC:106: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_Left.fallingEdge() ) { Joystick.button( 3, 1); }

    ^

    GamePi_2_teensy_LC:107: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_Right.fallingEdge() ) { Joystick.button( 4, 1); }

    ^

    GamePi_2_teensy_LC:109: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_A.fallingEdge() ) { Joystick.button( 5, 1); }

    ^

    GamePi_2_teensy_LC:110: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_B.fallingEdge() ) { Joystick.button( 6, 1); }

    ^

    GamePi_2_teensy_LC:111: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_X.fallingEdge() ) { Joystick.button( 7, 1); }

    ^

    GamePi_2_teensy_LC:112: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_Y.fallingEdge() ) { Joystick.button( 8, 1); }

    ^

    GamePi_2_teensy_LC:114: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_L1.fallingEdge() ) { Joystick.button( 9, 1); }

    ^

    GamePi_2_teensy_LC:115: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_L2.fallingEdge() ) { Joystick.button(10, 1); }

    ^

    GamePi_2_teensy_LC:116: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_R1.fallingEdge() ) { Joystick.button(11, 1); }

    ^

    GamePi_2_teensy_LC:117: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_R2.fallingEdge() ) { Joystick.button(12, 1); }

    ^

    GamePi_2_teensy_LC:119: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_Start.fallingEdge() ) { Joystick.button(13, 1); }

    ^

    GamePi_2_teensy_LC:120: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_Select.fallingEdge() ) { Joystick.button(14, 1); }

    ^

    GamePi_2_teensy_LC:122: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( an_L_btn.fallingEdge() ) { Joystick.button(15, 1); }

    ^

    GamePi_2_teensy_LC:123: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( an_R_btn.fallingEdge() ) { Joystick.button(16, 1); }

    ^

    GamePi_2_teensy_LC:127: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_Up.risingEdge() ) { Joystick.button( 1, 0); }

    ^

    GamePi_2_teensy_LC:128: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_Down.risingEdge() ) { Joystick.button( 2, 0); }

    ^

    GamePi_2_teensy_LC:129: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_Left.risingEdge() ) { Joystick.button( 3, 0); }

    ^

    GamePi_2_teensy_LC:130: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_Right.risingEdge() ) { Joystick.button( 4, 0); }

    ^

    GamePi_2_teensy_LC:132: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_A.risingEdge() ) { Joystick.button( 5, 0); }

    ^

    GamePi_2_teensy_LC:133: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_B.risingEdge() ) { Joystick.button( 6, 0); }

    ^

    GamePi_2_teensy_LC:134: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_X.risingEdge() ) { Joystick.button( 7, 0); }

    ^

    GamePi_2_teensy_LC:135: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_Y.risingEdge() ) { Joystick.button( 8, 0); }

    ^

    GamePi_2_teensy_LC:137: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_L1.risingEdge() ) { Joystick.button( 9, 0); }

    ^

    GamePi_2_teensy_LC:138: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_L2.risingEdge() ) { Joystick.button(10, 0); }

    ^

    GamePi_2_teensy_LC:139: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_R1.risingEdge() ) { Joystick.button(11, 0); }

    ^

    GamePi_2_teensy_LC:140: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_R2.risingEdge() ) { Joystick.button(12, 0); }

    ^

    GamePi_2_teensy_LC:142: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_Start.risingEdge() ) { Joystick.button(13, 0); }

    ^

    GamePi_2_teensy_LC:143: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( btn_Select.risingEdge() ) { Joystick.button(14, 0); }

    ^

    GamePi_2_teensy_LC:145: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( an_L_btn.risingEdge() ) { Joystick.button(15, 0); }

    ^

    GamePi_2_teensy_LC:146: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    if( an_R_btn.risingEdge() ) { Joystick.button(16, 0); }

    ^

    GamePi_2_teensy_LC:150: error: 'Joystick' was not declared in this scope
    To make a USB Joystick, use the Tools > USB Type menu
    Joystick.X( analogRead( an_L_x ) );

    ^

    'Joystick' was not declared in this scope

    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,108
    Before compiling, use the Tools menu and select "USB Type". From the dropdown menu select "Serial + Keyboard + Mouse+ Joystick". Then compile.

    Pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •