Go Down

Topic: Arduino mega 16 analog pot problem (Read 471 times) previous topic - next topic

Xicury

Greetings friends, a doubt, you can use the 16 analog outputs for potentiometers in a mega arduino ?, I have a code that is for arduino one and does not accept me more analog inputs, try a miltiplexer and the problem is that it does not work with Hiduino , What I can do? I don't know how to program and I couldn't finish the project, I will be very grateful with your help, good vibes

CrossRoads

Yes, you can use the 16 analog INputs to read pot's in a Mega.
A0 to A15.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

PieterP

#2
Jul 31, 2019, 08:39 pm Last Edit: Jul 31, 2019, 08:40 pm by PieterP
You might be interested in my MIDI Controller library.
The Hiduino instructions are in the readme.

You can use this example for potentiometers:
Code: [Select]
#include <MIDI_Controller.h> // Include the library

// Create an array of new instance of the class 'Analog', called 'potentiometers'
Analog potentiometers[] = {
  {A0, MIDI_CC::Channel_Volume, 1},  // pin A0, sends MIDI messages with controller 7 (channel volume) on channel 1
  {A1, MIDI_CC::Channel_Volume, 2},
  // Etc.
};

void setup() {}

void loop() {
  // Refresh the MIDI controller (check whether the potentiometer's input has changed since last time, if so, send the new value over MIDI)
  MIDI_Controller.refresh();
}


Pieter

Go Up