MIDI Elements
Library to simplify handling of components for MIDI controllers
 All Classes Files Functions Variables Macros
Potentiometer.h
Go to the documentation of this file.
1 // MIDI Elements Potentiometer class
2 // Library to simplify handling of components for MIDI controllers
3 // Created by Tomash Ghz
4 // www.tomashg.com
5 // ghz.tomash@gmail.com
6 
7 #ifndef Potentiometer_H
8 #define Potentiometer_H
9 
10 //-----------------------------------------------------------------------------------
11 #include "WProgram.h" //It is very important to remember this! note that if you are using Arduino 1.0 IDE, change "WProgram.h" to "Arduino.h"
12 
20 private:
21  bool debugging; // is debugging on
22  bool secondary; // send secondary midi signal
23  bool mapped;
24  int inMin, inMax;
25  int lastValue;
26  int tempRead;
27  int readValues[3];
28  byte pin; // pin on teensy
29  byte channel; // midi channel
30  byte number; // midi number
31  void midiCC(int v, int oldv);
32 public:
33  Potentiometer(byte p);
34  Potentiometer(byte p, byte c, byte n);
35  Potentiometer(byte p, byte c, byte n, bool sec);
36  Potentiometer(byte p, byte c, byte n, bool sec, bool debug);
37  ~Potentiometer(); // destructor
38  void read();
39  void readAvr();
40  int readValue(bool &changed);
41  int readValueAvr(bool &changed);
42  void changeSecondary(bool s);
43  void bound(int iMin, int iMax);
44 };
45 //-----------------------------------------------------------------------------------
46 
47 #endif
void readAvr()
read the values for couple of iterations for a smoother value and send a midi message if the fader or...
Definition: Potentiometer.cpp:54
int readValue(bool &changed)
read and return the analog value, pass state change
Definition: Potentiometer.cpp:84
int readValueAvr(bool &changed)
read and return a smooth analog value, pass state change
Definition: Potentiometer.cpp:92
void bound(int iMin, int iMax)
map and bound the analog readings to minimum and maximum values, useful for normalizing light or forc...
Definition: Potentiometer.cpp:76
Potentiometer(byte p)
constructor with pin number.
Definition: Potentiometer.cpp:11
~Potentiometer()
Definition: Potentiometer.cpp:33
void read()
read the values and send a midi message if the fader or knob state changed. use in main loop ...
Definition: Potentiometer.cpp:38
void changeSecondary(bool s)
enable or disable the secondary super knob cc messages
Definition: Potentiometer.cpp:150
Class for handling faders, knobs or other analog input.
Definition: Potentiometer.h:19