Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connect analog matrix ButtonKeypad #70

Open
santta opened this issue Nov 30, 2018 · 0 comments
Open

connect analog matrix ButtonKeypad #70

santta opened this issue Nov 30, 2018 · 0 comments

Comments

@santta
Copy link

santta commented Nov 30, 2018

2018-11-30_17-19-53
Good afternoon, Tttapa, I want to connect an analog ButtonKeypad (via USB MIDI library) and a rotary encoder (from your library).
But I get the error analogRead - "call of overloaded 'analogRead(const uint8_t&)' is ambiguous".

How can I connect this keyboard?
Robotdyn.com/Mod-ButtonKeypad4x4-EN

Description of the problem or question

Steps to reproduce the problem

Hardware:

Arduino board: Arduino Leonardo

Software versions:

MIDI Controller library: 3.1.0
Arduino IDE: 1.8.7
Operating System: Windows
Operating System version: 10

Settings in the IDE

Full code

// Your code here

#define USE_ROTARY_ENCODER
#include <MIDI.h>
#include "MIDIUSB.h"
#include <MIDI_Controller.h>  
//Constants

RotaryEncoder encoder5(10, 11, 0x0B, 1, 1, NORMAL_ENCODER, TWOS_COMPLEMENT);
RotaryEncoder encoder6(12, 13, 0x0C, 1, 1, NORMAL_ENCODER, TWOS_COMPLEMENT);

void noteOn(byte channel, byte pitch, byte velocity) {
  midiEventPacket_t noteOn = {0x09, 0x90 | channel, pitch, velocity};
  MidiUSB.sendMIDI(noteOn);
}


//Variables
int buttonValue; //Stores analog value when button is pressed


void setup()
{
  Serial.begin(31250); 
  
}

void loop()
{
  buttonValue = analogRead(A0); //Read analog value from A0 pin
  
  //For 1st button:
  if (buttonValue>=538 && buttonValue<=540){
    noteOn(0,36,127);
    MidiUSB.flush();
  }
  //For 2nd button:
  else if (buttonValue>=510 && buttonValue<=513){
    noteOn(0,37,127);
    MidiUSB.flush();
  }
  //For 3rd button:
  else if (buttonValue>=487  && buttonValue<=488){
    noteOn(0,38,127);
    MidiUSB.flush();
  }
  //For 4th button:
  else if (buttonValue>=638  && buttonValue<=639){
    noteOn(0,39,127);
    MidiUSB.flush();
  }
  //For 5th button:
  else if (buttonValue>=601  && buttonValue<=602){
   noteOn(0,40,127);
    MidiUSB.flush();
  }
   //For 6th button:
  else if (buttonValue>=568  && buttonValue<=569){
   noteOn(0,41,127);
    MidiUSB.flush();
  }
     //For 7th button:
  else if (buttonValue>=787  && buttonValue<=789){
   noteOn(0,42,127);
    MidiUSB.flush();
  }
   //For 8th button:
  else if (buttonValue>=732  && buttonValue<=733){
   noteOn(0,43,127);
    MidiUSB.flush();
  }
   //For 9th button:
  else if (buttonValue>=683  && buttonValue<=684){
   noteOn(0,44,127);
    MidiUSB.flush();
  }
  //For 10th button:
  else if (buttonValue>=1022  && buttonValue<=1023){
   noteOn(0,45,127);
    MidiUSB.flush();
  }
  //For 11th button:
  else if (buttonValue>=931  && buttonValue<=933){
   noteOn(0,46,127);
    MidiUSB.flush();
  }
  //For 12th button:
  else if (buttonValue>=853  && buttonValue<=855){
   noteOn(0,47,127);
    MidiUSB.flush();
  }
   delay(400);
}

## Steps taken to try to diagnose or solve the problem
? Tried the MIDI debug mode, used a MIDI monitor, ... ?

## The goal of your project and aditional information
@santta santta changed the title connect an analog matrix keyboard connect analog matrix keyboard Nov 30, 2018
@santta santta changed the title connect analog matrix keyboard connect analog matrix ButtonKeypad Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant