tttapa / MIDI_controller

This is a library for creating a MIDI controller using an Arduino or Teensy board.
GNU General Public License v3.0
404 stars 69 forks source link

XY pads (gamepad dognose "shroom" pads) as potentiometers ? #85

Closed zstima closed 5 years ago

zstima commented 5 years ago

so the pad is something like this, in fact, exactly like this:

https://tkkrlab.nl/wiki/Arduino_KY-023_XY-axis_joystick_module

i tried declaring the X and Y axises as 2 Analog objects like in the instructions.

im using leonardo board and connected the X to A5 and Y to A4, and ommited the digital button feature (waiting for wires kit to arrive in mailbox)

my code is as follows:

``

include

#include <LiquidCrystal_I2C.h>
#include <MIDI_Controller.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 20, 4);
int boom = 60;
int xysleep = 512;
int x,y;
void setup()
{
    // initialize the LCD
    lcd.begin();

// Turn on the blacklight and print a message.
    //lcd.backlight();
lcd.setCursor(0,0);
//lcd.print("xy data: ");
Analog analog_x(A5, MIDI_CC::Channel_Volume, 1);
Analog analog_y(A4, MIDI_CC::Channel_Volume, 2);

}
void loop()
{ 
MIDI_Controller.refresh();
}

``

note: the wiring is fine and normally i could just print the values on the LCD using

analogRead(A5)

another issue: i would like to print the analog values on the LCD: theres a compiling error if u try to use analogRead(pin) while using the the same pin as a Midi Analog, i think because analogRead is overloaded, this might be a lib design issue u should look into

i see a map function which returns the analog value, should i just send a function pointer to a function which just returns the value as is ?

i hope my question is clear

more info:

i tried using ableton version 10 and it recognizes the input board under preferences -> link/midi as "arduino leonardo"

zstima commented 5 years ago

update: im getting messages in the serial monitor, so the lib works fine i guess.

must be a problem with ableton/reaper