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

Thread: Teensy 2.0 can't get 3 Expression Pedals working

  1. #1
    Junior Member
    Join Date
    Jun 2021
    Posts
    13

    Teensy 2.0 can't get 3 Expression Pedals working

    I made a Midi Foot Switch and made 3 inputs for Expression Pedals. 2 of them are on A0 and A1. I used Midi learn. They show up 16 and 17 as midi message. But the third expression pedal is not working properly. It depends where the pedal position is. It is showing 16, 17 or 18. And there is a delay. Can somebody help me. I checked the soldering twice. Thanks

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,750
    Post a photo of the connections to the Teensy2.
    What is Midi learn?

    It is showing 16, 17 or 18
    What is "It"? Where does this show? If you are referring to pin numbers then A0 is pin 21, A1 is pin 20 and A2 is pin 19.

    Pete

  3. #3
    Junior Member
    Join Date
    Jun 2021
    Posts
    13
    Sorry for the bad description. I am sending Midi CC messages to a software. For A0 I definded 16 as a number. For A1 17 for the control number and A2 should be 18 but when I move the pedal it toggles between 16, 17 and 18. Here is a pic how it is soldered. Checked it twice. Click image for larger version. 

Name:	Screenshot_20210820-080629.jpg 
Views:	20 
Size:	42.1 KB 
ID:	25616
    Last edited by miasei; 08-20-2021 at 06:09 AM.

  4. #4
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    941
    @miasei - your diagram has two of the connectors of P3 PIN going to the same row, they should be as you have the first two, going to different connection points. If truely wired this way, you have both going to ground or whatever.

  5. #5
    Junior Member
    Join Date
    Jun 2021
    Posts
    13
    The diagram is not correct. Black goes to minus! Red to plus. That is not the problem.

  6. #6
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,750
    Post your code (in code tags please).

    Pete

  7. #7
    Junior Member
    Join Date
    Jun 2021
    Posts
    13
    Here is the code. I use the Control Surface library.

    Code:
    #include <Wire.h>
    #include <hd44780.h>                       // main hd44780 header
    #include <hd44780ioClass/hd44780_I2Cexp.h> // i2c expander i/o class header
    
    //hd44780_I2Cexp lcd; // declare lcd object: auto locate & auto config expander chip
    
    hd44780_I2Cexp lcd1(0x27);
    hd44780_I2Cexp lcd2(0x26);
    
    const int LCD_COLS = 16;
    const int LCD_ROWS = 4;
    
    
    #include <Control_Surface.h> // Include the Control Surface library
     
    USBMIDI_Interface midi; // Instantiate a MIDI over USB interface.
     
    // Instantiate an array of CCButton objects that send MIDI control
    // change messages whenever the button is pressed/released
    CCButton buttons[] {
      {0, 85}, // button pin number, controller number
      {1, 86},
      {2, 87},
      {3, 88},
      {4, 89},
      {8, 90},
      {9, 91},
      {10, 92},
      };
    // Create an array of CCValueLED objects that turn on/off an LED
    // depending on the MIDI control change messages they receive
    CCValueLED leds[] {
      {11, 85}, // led pin number, controller number
      {12, 86},
      {13, 87},
      {14, 88},
      {15, 89},
      {16, 90},
      {17, 91},
      {18, 92},  
      };
    
    // Instantiate a CCPotentiometer object
    CCPotentiometer potentiometer[] = {
      {A0,0x10},                                   // Analog pin connected to potentiometer
      {MIDI_CC::Channel_Volume, CHANNEL_1}, // Channel volume of channel 1
      {A1,0x11},
      {MIDI_CC::Channel_Volume, CHANNEL_1}, // Channel volume of channel 1
      {A2,0x12},
      {MIDI_CC::Channel_Volume, CHANNEL_1}, // Channel volume of channel 1
          };
    
    
    void setup() {
      Control_Surface.begin(); // Initialize Control Surface
    
    
      int status;
    
      // initialize LCD with number of columns and rows: 
      // hd44780 returns a status from begin() that can be used
      // to determine if initalization failed.
      // the actual status codes are defined in <hd44780.h>
      // See the values RV_XXXX
      //
      // looking at the return status from begin() is optional
      // it is being done here to provide feedback should there be an issue
      //
      // note:
      //  begin() will automatically turn on the backlight
      //
      status = lcd1.begin(LCD_COLS, LCD_ROWS);
      status = lcd2.begin(LCD_COLS, LCD_ROWS);
      //if(status) // non zero status means it was unsuccesful
    
      
      {
        // hd44780 has a fatalError() routine that blinks an led if possible
        // begin() failed so blink error code using the onboard LED if possible
        //hd44780::fatalError(status); // does not return
      }
    
      // initalization was successful, the backlight should be on now
    
      // Print a message to the LCD
       lcd2.print("CHORUS    PHASER                                        DELAY 1  DELAY 2");
       lcd1.print("FLANGER  TREMOLO                                        OD     CW Filter");
    }
     
    void loop() {
      Control_Surface.loop(); // Update the Control Surface
    }

  8. #8
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,750
    There doesn't seem to be anything wrong with the code - no pin conflicts etc.
    Can you post a photo which clearly shows the connections to the Teesy2? Especially pins A0,A1,A2.

    Pete

  9. #9
    Junior Member
    Join Date
    Jun 2021
    Posts
    13
    I can post it later. So it seems to be a bad wiring or something. I think I have tried the expression pedal connection without the code for A2 and it is still working as described. So maybe I will try a rewiring only for that pin A2.

  10. #10
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    941
    it does sound like a connection issue. check for solder bridge? You will have done it already, but double / triple check pin locations: https://www.pjrc.com/teensy/pinout.html
    and half way down this page: https://www.pjrc.com/teensy/tutorial4.html
    swap pedals out if possible, to eliminate
    explore using a different analog pin to A2 - possible inherited conflict?

  11. #11
    Junior Member
    Join Date
    Jun 2021
    Posts
    13
    Hello there. Thanks again. Checked it out today. Seems that the Analog Pin is faulty. Connected it to another Analog PIN and it is working! Have a good day!

Posting Permissions

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