3 posts in this topic


I am trying to implement foot controller with some tactile switches. I am trying to capture a button press and send MIDI data. I have trying to use the tutorial polling_j5_pins. I have changed the user button (PA0) to get initialized. I am unable to use the button yet to send a MIDI signal to computer. Where am i missing something to capture button press. The program doesnt enter the if condition shown in second image.



Edited by prusaga

Share this post

Link to post
Share on other sites

where in the program did you put the "pin changed" code? i am pretty sure that you have to initalize the pins in the app-init, as a Digital input before..

if you have time till the day after tomorrow, i am not at home right now...

Share this post

Link to post
Share on other sites


i used J5 for LED Indication, and one User-Button, see this: MSQ-CC-BCR

i used this code for Initialisation:

void APP_Init(void){

  // LED:  initialize J5A pin1-3 & J5B pin0-3 as outputs in Push-Pull Mode
  int pin;
  for(pin=1; pin<8; ++pin) {MIOS32_BOARD_J5_PinInit(pin, MIOS32_BOARD_PIN_MODE_OUTPUT_PP);}
     int a; for(a=1; a<8; a++) { MIOS32_BOARD_J5_PinSet(a, 0);} //Turn off all LEDs
  // MOMENTARY-BUTTON   initialize pin 0 of J5A,  as Digital input with internal Pull-Up


as exemple - in app background, for reading the J5 States:

void APP_Background(void){    // Set Bet Structure without LCD but with PIN 1 of J5A
	static rythm = 0; // initalized once
    // check J5 pin 0 for changes
    static s16 count       = 0;
    if ( MIOS32_BOARD_J5_PinGet(0) == 0 ) { count = 500; }
    if ( count != 0  ) { count--; }
    if ( count == 1 )  {                        
                rythm_count++; // count thru

                switch ( rythm_count ) {
                        case 1:  rythm = 3;  break;
                        case 2:  rythm = 4;  break;
                        case 3:  rythm = 5;  break;
                        case 4:  rythm = 6;  break;
                        case 5:  rythm = 7;  break;
                        case 6:  rythm = 9;  break;
                        case 7:  rythm = 11; break;
                        default: rythm = 13; break;

if you want to Activate a J5 with the variable rythm_count from above (switch thru the LEDs), put it also in APP_Background for example

                    for( x=1; x<8; x++) { MIOS32_BOARD_J5_PinSet(x, 0);}   // Turn off all LEDs
                    switch ( rythm ) {
                        case 3:  MIOS32_BOARD_J5_PinSet(1, 1); break; // Turn on one LED - Indicate rythmset
                        case 4:  MIOS32_BOARD_J5_PinSet(2, 1); break;
                        case 5:  MIOS32_BOARD_J5_PinSet(3, 1); break;
                        case 7:  MIOS32_BOARD_J5_PinSet(4, 1); break;
                        case 9:  MIOS32_BOARD_J5_PinSet(5, 1); break;
                        case 11: MIOS32_BOARD_J5_PinSet(6, 1); break;
                        case 13: MIOS32_BOARD_J5_PinSet(7, 1); break;} break;



i am still unsure what you mean with USER-Button, if you mean one of the onboard buttons, i cant help you... stil i dont see a need to use them to initalize the J5 GPIO... i would do this in APP_Init hardcodet, or with a other DIN... however thats it from my side.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now