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

Thread: Teensy LC-Rotary Encoders

  1. #1
    Junior Member
    Join Date
    May 2020
    Posts
    7

    Teensy LC-Rotary Encoders

    Hi,

    Hoping someone can help with the continuing saga of my first attempt at a repair job on a sim racing button box...

    After various trials and errors I'm so tied up in knots I don't even know where to go now. To cut a long story short, I have managed to program a Teensy LC as per my schematic attached. All buttons are working except the rotary switches. These are the CTS288V which I have attached a tech document for. This button box will be used on iRacing and had requested help there, and was informed by a staff member there that the CTS288V is not a quadrature encoder so I should just program the PIN for each directional rotation as a button. The problem I'm finding is that when I rotate the switch it does register a button press (so yeah its working), but it also will register the other pin for the anticlockwise rotation, so its not very helpful as the switch is kind of giving me two button presses and not really doing what I need.

    I've tried to educate myself on inputs and input pullups but I have to be honest and say I don't really understand it. I'm guessing there is something not quite right with how the rotary resets the button press and it holds that button/PIN in/on but I'm not sure how to go about rectifying it. The main point is should this be a button press or using encoder in the script...I'm so lost its not even funny!

    As mentioned I have attached my schematic, data sheet for the rotary and I'll copy my code below.

    Code:
    #include <Bounce.h>
    
    
    Bounce button0 = Bounce(0, 10);
    Bounce button1 = Bounce(1, 10);
    Bounce button2 = Bounce(2, 10);
    Bounce button3 = Bounce(3, 10);
    Bounce button4 = Bounce(4, 10);
    Bounce button5 = Bounce(5, 10);
    Bounce button6 = Bounce(6, 10); 
    Bounce button7 = Bounce(7, 10);
    Bounce button8 = Bounce(8, 10);
    Bounce button9 = Bounce(9, 10);
    Bounce button13 = Bounce(13, 10);
    Bounce button14 = Bounce(14, 10);
    Bounce button15 = Bounce(15, 10);
    Bounce button16 = Bounce(16, 10);
    Bounce button17 = Bounce(17, 10);
    Bounce button18 = Bounce(18, 10);
    
    
    void setup() {
      
      pinMode(0, INPUT_PULLUP);
      pinMode(1, INPUT_PULLUP);
      pinMode(2, INPUT_PULLUP);
      pinMode(3, INPUT_PULLUP);
      pinMode(4, INPUT_PULLUP);
      pinMode(5, INPUT_PULLUP);
      pinMode(6, INPUT_PULLUP);
      pinMode(7, INPUT_PULLUP);
      pinMode(8, INPUT_PULLUP);
      pinMode(9, INPUT_PULLUP);
      pinMode(13, INPUT_PULLUP);
      pinMode(14, INPUT_PULLUP);
      pinMode(15, INPUT_PULLUP);  
      pinMode(16, INPUT_PULLUP);
      pinMode(17, INPUT_PULLUP);
      pinMode(18, INPUT_PULLUP);
      
     
    }
    
    
    void loop() {
     
       
      button0.update();
      button1.update();
      button2.update();
      button3.update();
      button4.update();
      button5.update();
      button6.update();
      button7.update();
      button8.update();
      button9.update();
      button13.update();
      button14.update();
      button15.update();
      button16.update();
      button17.update();
      button18.update();
    
      if (button0.fallingEdge()) {
        Joystick.button(1, 1);
      }
      if (button1.fallingEdge()) {
        Joystick.button(2, 1);
      }
      if (button2.fallingEdge()) {
        Joystick.button(3, 1);
      }
      if (button3.fallingEdge()) {
        Joystick.button(4, 1);
      }
      if (button4.fallingEdge()) {
        Joystick.button(5, 1);
      }
      if (button5.fallingEdge()) {
        Joystick.button(6, 1);
      }
      if (button6.fallingEdge()) {
        Joystick.button(7, 1);
      }
      if (button7.fallingEdge()) {
        Joystick.button(8, 1);
      }
      if (button8.fallingEdge()) {
        Joystick.button(9, 1);
      }
      if (button9.fallingEdge()) {
        Joystick.button(10, 1);
      }
      if (button13.fallingEdge()) {
        Joystick.button(14, 1);
      }
      if (button14.fallingEdge()) {
        Joystick.button(15, 1);
      }
      if (button15.fallingEdge()) {
        Joystick.button(16, 1);
      }
      if (button16.fallingEdge()) {
        Joystick.button(17, 1);
      }
      if (button17.fallingEdge()) {
        Joystick.button(18, 1);
      }
      if (button18.fallingEdge()) {
        Joystick.button(19, 1);
      }
    
      if (button0.risingEdge()) {
        Joystick.button(1, 0);
      }
      if (button1.risingEdge()) {
        Joystick.button(2, 0);
      }
      if (button2.risingEdge()) {
        Joystick.button(3, 0);
      }
      if (button3.risingEdge()) {
        Joystick.button(4, 0);
      }
      if (button4.risingEdge()) {
        Joystick.button(5, 0);
      }
      if (button5.risingEdge()) {
        Joystick.button(6, 0);
      }
      if (button6.risingEdge()) {
        Joystick.button(7, 0);
      }
      if (button7.risingEdge()) {
        Joystick.button(8, 0);
      }  
      if (button8.risingEdge()) {
        Joystick.button(9, 0);
      }
        if (button9.risingEdge()) {
        Joystick.button(10, 0);
      }
        if (button13.risingEdge()) {
        Joystick.button(14, 0);
      }
      if (button14.risingEdge()) {
        Joystick.button(15, 0);
      }
      if (button15.risingEdge()) {
        Joystick.button(16, 0);
      }
      if (button16.risingEdge()) {
        Joystick.button(17, 0);
      }
      if (button17.risingEdge()) {
        Joystick.button(18, 0);
      }
      if (button18.risingEdge()) {
        Joystick.button(19, 0);
     
      }
    }
    Attached Files Attached Files

  2. #2
    Senior Member
    Join Date
    Mar 2016
    Posts
    167
    Looking at the 288V from your data sheet, it appears to be, indeed, quadrature encoded. A and B should be used as input the quad encoder calculations. Use the encoder library. It works but reports 4X the number of steps if your encoder has clicks so adjust appropriately. A tip, if it reports a non multiple of 4 steps, save the remainder and add it to the next report (or write it back to the encoder).
    Last edited by PhilB; 05-21-2020 at 02:40 PM.

  3. #3
    Junior Member
    Join Date
    May 2020
    Posts
    7
    Quote Originally Posted by PhilB View Post
    Looking at the 288V from your data sheet, it appears to be, indeed, quadrature encoded. A and B should be used as input the quad encoder calculations. Use the encoder library. It works but reports 4X the number of steps if your encoder has clicks so adjust appropriately. A tip, if it reports a non multiple of 4 steps, save the remainder and add it to the next report (or write it back to the encoder).
    Hi Phil. Thanks for the reply. Trying a new script but still struggling. New code below but getting an error reporting "'positionLeft' was not declared in this scope". Lost again

    Code:
    #include <Bounce.h>
    #include <Encoder.h>
    
    Bounce button0 = Bounce(0, 10);
    Bounce button1 = Bounce(1, 10);
    Bounce button6 = Bounce(6, 10); 
    Bounce button7 = Bounce(7, 10);
    Bounce button8 = Bounce(8, 10);
    Bounce button9 = Bounce(9, 10);
    Bounce button13 = Bounce(13, 10);
    Bounce button14 = Bounce(14, 10);
    Bounce button15 = Bounce(15, 10);
    Bounce button16 = Bounce(16, 10);
    Bounce button17 = Bounce(17, 10);
    Bounce button18 = Bounce(18, 10);
    Encoder knobLeft(2, 3);
    Encoder knobRight(4, 5);
    
    
    void setup() {
    
        Serial.begin(9600);
    
    long positionLeft  = -999;
    long positionRight = -999;  
      
      pinMode(0, INPUT_PULLUP);
      pinMode(1, INPUT_PULLUP);
      pinMode(6, INPUT_PULLUP);
      pinMode(7, INPUT_PULLUP);
      pinMode(8, INPUT_PULLUP);
      pinMode(9, INPUT_PULLUP);
      pinMode(13, INPUT_PULLUP);
      pinMode(14, INPUT_PULLUP);
      pinMode(15, INPUT_PULLUP);  
      pinMode(16, INPUT_PULLUP);
      pinMode(17, INPUT_PULLUP);
      pinMode(18, INPUT_PULLUP);
       
    }
    
    void loop() {
     
    {
      long newLeft; 
      newLeft = knobLeft.read()/4;  
      if (newLeft != positionLeft){
      
        Serial.println(newLeft);  
        positionLeft = newLeft;  
     
      delay(1); //delay for stability
    }
      long newRight; 
      newRight = knobRight.read()/4;  
      if (newRight != positionRight) {
      
        Serial.println(newRight);  
        positionRight = newRight;  
     
      delay(1); 
      }
       
      button0.update();
      button1.update();
      button6.update();
      button7.update();
      button8.update();
      button9.update();
      button13.update();
      button14.update();
      button15.update();
      button16.update();
      button17.update();
      button18.update();
    
      if (button0.fallingEdge()) {
        Joystick.button(1, 1);
      }
      if (button1.fallingEdge()) {
        Joystick.button(2, 1);
      }
      if (button6.fallingEdge()) {
        Joystick.button(7, 1);
      }
      if (button7.fallingEdge()) {
        Joystick.button(8, 1);
      }
      if (button8.fallingEdge()) {
        Joystick.button(9, 1);
      }
      if (button9.fallingEdge()) {
        Joystick.button(10, 1);
      }
      if (button13.fallingEdge()) {
        Joystick.button(14, 1);
      }
      if (button14.fallingEdge()) {
        Joystick.button(15, 1);
      }
      if (button15.fallingEdge()) {
        Joystick.button(16, 1);
      }
      if (button16.fallingEdge()) {
        Joystick.button(17, 1);
      }
      if (button17.fallingEdge()) {
        Joystick.button(18, 1);
      }
      if (button18.fallingEdge()) {
        Joystick.button(19, 1);
      }
    
      if (button0.risingEdge()) {
        Joystick.button(1, 0);
      }
      if (button1.risingEdge()) {
        Joystick.button(2, 0);
      }
      if (button7.risingEdge()) {
        Joystick.button(8, 0);
      }  
      if (button8.risingEdge()) {
        Joystick.button(9, 0);
      }
        if (button9.risingEdge()) {
        Joystick.button(10, 0);
      }
        if (button13.risingEdge()) {
        Joystick.button(14, 0);
      }
      if (button14.risingEdge()) {
        Joystick.button(15, 0);
      }
      if (button15.risingEdge()) {
        Joystick.button(16, 0);
      }
      if (button16.risingEdge()) {
        Joystick.button(17, 0);
      }
      if (button17.risingEdge()) {
        Joystick.button(18, 0);
      }
      if (button18.risingEdge()) {
        Joystick.button(19, 0);
     
      }
    }
    Last edited by SteveC78; 05-22-2020 at 02:31 PM.

  4. #4
    Senior Member
    Join Date
    Apr 2020
    Location
    DFW area in Texas
    Posts
    115
    Quote Originally Posted by SteveC78 View Post
    Hi Phil. Thanks for the reply. Trying a new script but still struggling. New code below but getting an error reporting "'positionLeft' was not declared in this scope". Lost again

    Code:
    #include <Bounce.h>
    #include <Encoder.h>
    
    Bounce button0 = Bounce(0, 10);
    Bounce button1 = Bounce(1, 10);
    Bounce button6 = Bounce(6, 10); 
    Bounce button7 = Bounce(7, 10);
    Bounce button8 = Bounce(8, 10);
    Bounce button9 = Bounce(9, 10);
    Bounce button13 = Bounce(13, 10);
    Bounce button14 = Bounce(14, 10);
    Bounce button15 = Bounce(15, 10);
    Bounce button16 = Bounce(16, 10);
    Bounce button17 = Bounce(17, 10);
    Bounce button18 = Bounce(18, 10);
    Encoder knobLeft(2, 3);
    Encoder knobRight(4, 5);
    
    
    void setup() {
    
        Serial.begin(9600);
    
    long positionLeft  = -999;
    long positionRight = -999;  
      
      pinMode(0, INPUT_PULLUP);
      pinMode(1, INPUT_PULLUP);
      pinMode(6, INPUT_PULLUP);
      pinMode(7, INPUT_PULLUP);
      pinMode(8, INPUT_PULLUP);
      pinMode(9, INPUT_PULLUP);
      pinMode(13, INPUT_PULLUP);
      pinMode(14, INPUT_PULLUP);
      pinMode(15, INPUT_PULLUP);  
      pinMode(16, INPUT_PULLUP);
      pinMode(17, INPUT_PULLUP);
      pinMode(18, INPUT_PULLUP);
       
    }
    
    void loop() {
     
    {
      long newLeft; 
      newLeft = knobLeft.read()/4;  
      if (newLeft != positionLeft){
      
        Serial.println(newLeft);  
        positionLeft = newLeft;  
     
      delay(1); //delay for stability
    }
      long newRight; 
      newRight = knobRight.read()/4;  
      if (newLeft != positionLeft) {
      
        Serial.println(newRight);  
        positionRight = newRight;  
     
      delay(1); 
      }
       
      button0.update();
      button1.update();
      button6.update();
      button7.update();
      button8.update();
      button9.update();
      button13.update();
      button14.update();
      button15.update();
      button16.update();
      button17.update();
      button18.update();
    
      if (button0.fallingEdge()) {
        Joystick.button(1, 1);
      }
      if (button1.fallingEdge()) {
        Joystick.button(2, 1);
      }
      if (button2.fallingEdge()) {
        Joystick.button(3, 1);
      }
      if (button3.fallingEdge()) {
        Joystick.button(4, 1);
      }
      if (button4.fallingEdge()) {
        Joystick.button(5, 1);
      }
      if (button5.fallingEdge()) {
        Joystick.button(6, 1);
      }
      if (button6.fallingEdge()) {
        Joystick.button(7, 1);
      }
      if (button7.fallingEdge()) {
        Joystick.button(8, 1);
      }
      if (button8.fallingEdge()) {
        Joystick.button(9, 1);
      }
      if (button9.fallingEdge()) {
        Joystick.button(10, 1);
      }
      if (button13.fallingEdge()) {
        Joystick.button(14, 1);
      }
      if (button14.fallingEdge()) {
        Joystick.button(15, 1);
      }
      if (button15.fallingEdge()) {
        Joystick.button(16, 1);
      }
      if (button16.fallingEdge()) {
        Joystick.button(17, 1);
      }
      if (button17.fallingEdge()) {
        Joystick.button(18, 1);
      }
      if (button18.fallingEdge()) {
        Joystick.button(19, 1);
      }
    
      if (button0.risingEdge()) {
        Joystick.button(1, 0);
      }
      if (button1.risingEdge()) {
        Joystick.button(2, 0);
      }
      if (button2.risingEdge()) {
        Joystick.button(3, 0);
      }
      if (button3.risingEdge()) {
        Joystick.button(4, 0);
      }
      if (button4.risingEdge()) {
        Joystick.button(5, 0);
      }
      if (button5.risingEdge()) {
        Joystick.button(6, 0);
      }
      if (button6.risingEdge()) {
        Joystick.button(7, 0);
      }
      if (button7.risingEdge()) {
        Joystick.button(8, 0);
      }  
      if (button8.risingEdge()) {
        Joystick.button(9, 0);
      }
        if (button9.risingEdge()) {
        Joystick.button(10, 0);
      }
        if (button13.risingEdge()) {
        Joystick.button(14, 0);
      }
      if (button14.risingEdge()) {
        Joystick.button(15, 0);
      }
      if (button15.risingEdge()) {
        Joystick.button(16, 0);
      }
      if (button16.risingEdge()) {
        Joystick.button(17, 0);
      }
      if (button17.risingEdge()) {
        Joystick.button(18, 0);
      }
      if (button18.risingEdge()) {
        Joystick.button(19, 0);
     
      }
    }
    SteveC78:

    With the two lines ("long positionLeft = -999;" & "long positionRight = -999;") inside the setup() function, their scope (where they are allowed to be accessed) is limited to only inside the setup() function. This prevents them from being "seen" anywhere else. So, in your case, you want to make these two lines available to "global" scope by moving them just below the "Encoder knobRight(4, 5);" line.

    Hope that helps . . .

    Good luck & have fun !!

    Mark J Culross
    KD5RXT

  5. #5
    Junior Member
    Join Date
    May 2020
    Posts
    7
    Quote Originally Posted by SteveC78 View Post
    Hi Phil. Thanks for the reply. Trying a new script but still struggling. New code below but getting an error reporting "'positionLeft' was not declared in this scope". Lost again

    Code:
    #include <Bounce.h>
    #include <Encoder.h>
    
    Bounce button0 = Bounce(0, 10);
    Bounce button1 = Bounce(1, 10);
    Bounce button6 = Bounce(6, 10); 
    Bounce button7 = Bounce(7, 10);
    Bounce button8 = Bounce(8, 10);
    Bounce button9 = Bounce(9, 10);
    Bounce button13 = Bounce(13, 10);
    Bounce button14 = Bounce(14, 10);
    Bounce button15 = Bounce(15, 10);
    Bounce button16 = Bounce(16, 10);
    Bounce button17 = Bounce(17, 10);
    Bounce button18 = Bounce(18, 10);
    Encoder knobLeft(2, 3);
    Encoder knobRight(4, 5);
    
    
    void setup() {
    
        Serial.begin(9600);
    
    long positionLeft  = -999;
    long positionRight = -999;  
      
      pinMode(0, INPUT_PULLUP);
      pinMode(1, INPUT_PULLUP);
      pinMode(6, INPUT_PULLUP);
      pinMode(7, INPUT_PULLUP);
      pinMode(8, INPUT_PULLUP);
      pinMode(9, INPUT_PULLUP);
      pinMode(13, INPUT_PULLUP);
      pinMode(14, INPUT_PULLUP);
      pinMode(15, INPUT_PULLUP);  
      pinMode(16, INPUT_PULLUP);
      pinMode(17, INPUT_PULLUP);
      pinMode(18, INPUT_PULLUP);
       
    }
    
    void loop() {
     
    {
      long newLeft; 
      newLeft = knobLeft.read()/4;  
      if (newLeft != positionLeft){
      
        Serial.println(newLeft);  
        positionLeft = newLeft;  
     
      delay(1); //delay for stability
    }
      long newRight; 
      newRight = knobRight.read()/4;  
      if (newRight != positionRight) {
      
        Serial.println(newRight);  
        positionRight = newRight;  
     
      delay(1); 
      }
       
      button0.update();
      button1.update();
      button6.update();
      button7.update();
      button8.update();
      button9.update();
      button13.update();
      button14.update();
      button15.update();
      button16.update();
      button17.update();
      button18.update();
    
      if (button0.fallingEdge()) {
        Joystick.button(1, 1);
      }
      if (button1.fallingEdge()) {
        Joystick.button(2, 1);
      }
      if (button6.fallingEdge()) {
        Joystick.button(7, 1);
      }
      if (button7.fallingEdge()) {
        Joystick.button(8, 1);
      }
      if (button8.fallingEdge()) {
        Joystick.button(9, 1);
      }
      if (button9.fallingEdge()) {
        Joystick.button(10, 1);
      }
      if (button13.fallingEdge()) {
        Joystick.button(14, 1);
      }
      if (button14.fallingEdge()) {
        Joystick.button(15, 1);
      }
      if (button15.fallingEdge()) {
        Joystick.button(16, 1);
      }
      if (button16.fallingEdge()) {
        Joystick.button(17, 1);
      }
      if (button17.fallingEdge()) {
        Joystick.button(18, 1);
      }
      if (button18.fallingEdge()) {
        Joystick.button(19, 1);
      }
    
      if (button0.risingEdge()) {
        Joystick.button(1, 0);
      }
      if (button1.risingEdge()) {
        Joystick.button(2, 0);
      }
      if (button7.risingEdge()) {
        Joystick.button(8, 0);
      }  
      if (button8.risingEdge()) {
        Joystick.button(9, 0);
      }
        if (button9.risingEdge()) {
        Joystick.button(10, 0);
      }
        if (button13.risingEdge()) {
        Joystick.button(14, 0);
      }
      if (button14.risingEdge()) {
        Joystick.button(15, 0);
      }
      if (button15.risingEdge()) {
        Joystick.button(16, 0);
      }
      if (button16.risingEdge()) {
        Joystick.button(17, 0);
      }
      if (button17.risingEdge()) {
        Joystick.button(18, 0);
      }
      if (button18.risingEdge()) {
        Joystick.button(19, 0);
     
      }
    }


    Actually figured that part out...need positionLeft before Setup...TO be continued!

  6. #6
    Junior Member
    Join Date
    May 2020
    Posts
    7
    Quote Originally Posted by kd5rxt-mark View Post
    SteveC78:

    With the two lines ("long positionLeft = -999;" & "long positionRight = -999;") inside the setup() function, their scope (where they are allowed to be accessed) is limited to only inside the setup() function. This prevents them from being "seen" anywhere else. So, in your case, you want to make these two lines available to "global" scope by moving them just below the "Encoder knobRight(4, 5);" line.

    Hope that helps . . .

    Good luck & have fun !!

    Mark J Culross
    KD5RXT


    Thank you Mark Thats exactly what I noticed. I appreciate you taking the time...Got another error to figure out but I think the end is in site!

  7. #7
    Junior Member
    Join Date
    May 2020
    Posts
    7
    And working!! Thanks for the assists guys. Got the encoders working, and realised that what I needed was the encoder to fire up a momentary button press on a click either direction...its working in game as expected now! I've put the code below in case anyone is trying to do the same. Setting the type to Serial/mouse/keyboard/joystick. This was my first project, and enforced due to damage...so if you are doing this for the first time I recommend doing the script first with a breadboard set up. Long story but I have ended up with two boards and spare encoders, so I was able to set up a test for my script whilst my other board is safely locked inside a wheel button plate!

    Off to load up the finished script to the board I will be using. Thanks again for the pointers.

    Code:
    #include <Bounce.h>
    #include <Encoder.h>
    
    Bounce button0 = Bounce(0, 10);
    Bounce button1 = Bounce(1, 10);
    Bounce button6 = Bounce(6, 10); 
    Bounce button7 = Bounce(7, 10);
    Bounce button8 = Bounce(8, 10);
    Bounce button9 = Bounce(9, 10);
    Bounce button13 = Bounce(13, 10);
    Bounce button14 = Bounce(14, 10);
    Bounce button15 = Bounce(15, 10);
    Bounce button16 = Bounce(16, 10);
    Bounce button17 = Bounce(17, 10);
    Bounce button18 = Bounce(18, 10);
    Encoder knobLeft(2, 3);
    Encoder knobRight(4, 5);
    
    long positionLeft  = -999;
    long positionRight = -999; 
    
    void setup() {
    
      Serial.begin(9600); 
      Serial.println("Basic Encoder Test:"); 
      
      pinMode(0, INPUT_PULLUP);
      pinMode(1, INPUT_PULLUP);
      pinMode(6, INPUT_PULLUP);
      pinMode(7, INPUT_PULLUP);
      pinMode(8, INPUT_PULLUP);
      pinMode(9, INPUT_PULLUP);
      pinMode(13, INPUT_PULLUP);
      pinMode(14, INPUT_PULLUP);
      pinMode(15, INPUT_PULLUP);  
      pinMode(16, INPUT_PULLUP);
      pinMode(17, INPUT_PULLUP);
      pinMode(18, INPUT_PULLUP);
    
      long positionLeft  = -999;
      long positionRight = -999; 
    }
    
    void loop() 
     
    {
       long newLeft = knobLeft.read();
      if (newLeft > positionLeft) {
        positionLeft = newLeft;
        Joystick.button(3, 1);
        delay(100);
        Joystick.button(3, 0);
      }
      if (newLeft < positionLeft) {
        positionLeft = newLeft;
        Joystick.button(4, 1);
        delay(100);
        Joystick.button(4, 0);
     
      
    }
        long newRight = knobRight.read();
      if (newRight > positionRight) {
        positionRight = newRight;
        Joystick.button(5, 1);
        delay(100);
        Joystick.button(5, 0);
      }
      if (newRight < positionRight) {
        positionRight = newRight;
        Joystick.button(6, 1);
        delay(100);
        Joystick.button(6, 0); 
    
      }
       
      button0.update();
      button1.update();
      button6.update();
      button7.update();
      button8.update();
      button9.update();
      button13.update();
      button14.update();
      button15.update();
      button16.update();
      button17.update();
      button18.update();
    
      if (button0.fallingEdge()) {
        Joystick.button(1, 1);
      }
      if (button1.fallingEdge()) {
        Joystick.button(2, 1);
      }
      if (button6.fallingEdge()) {
        Joystick.button(7, 1);
      }
      if (button7.fallingEdge()) {
        Joystick.button(8, 1);
      }
      if (button8.fallingEdge()) {
        Joystick.button(9, 1);
      }
      if (button9.fallingEdge()) {
        Joystick.button(10, 1);
      }
      if (button13.fallingEdge()) {
        Joystick.button(14, 1);
      }
      if (button14.fallingEdge()) {
        Joystick.button(15, 1);
      }
      if (button15.fallingEdge()) {
        Joystick.button(16, 1);
      }
      if (button16.fallingEdge()) {
        Joystick.button(17, 1);
      }
      if (button17.fallingEdge()) {
        Joystick.button(18, 1);
      }
      if (button18.fallingEdge()) {
        Joystick.button(19, 1);
      }
    
      if (button0.risingEdge()) {
        Joystick.button(1, 0);
      }
      if (button1.risingEdge()) {
        Joystick.button(2, 0);
      }
      if (button7.risingEdge()) {
        Joystick.button(8, 0);
      }  
      if (button8.risingEdge()) {
        Joystick.button(9, 0);
      }
        if (button9.risingEdge()) {
        Joystick.button(10, 0);
      }
        if (button13.risingEdge()) {
        Joystick.button(14, 0);
      }
      if (button14.risingEdge()) {
        Joystick.button(15, 0);
      }
      if (button15.risingEdge()) {
        Joystick.button(16, 0);
      }
      if (button16.risingEdge()) {
        Joystick.button(17, 0);
      }
      if (button17.risingEdge()) {
        Joystick.button(18, 0);
      }
      if (button18.risingEdge()) {
        Joystick.button(19, 0);
      }
    
    }

Posting Permissions

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