MIDI Elements
Library to simplify handling of components for MIDI controllers
 All Classes Files Functions Variables Macros
Potentiometer Class Reference

Class for handling faders, knobs or other analog input. More...

#include <Potentiometer.h>

Public Member Functions

 Potentiometer (byte p)
 constructor with pin number. More...
 
 Potentiometer (byte p, byte c, byte n)
 constructor with pin number, midi channel and cc number . More...
 
 Potentiometer (byte p, byte c, byte n, bool sec)
 constructor with pin number, midi channel, cc number and secondary super knob. More...
 
 Potentiometer (byte p, byte c, byte n, bool sec, bool debug)
 constructor with pin number, midi channel, cc number, secondary super knob and debugging. More...
 
 ~Potentiometer ()
 
void read ()
 read the values and send a midi message if the fader or knob state changed. use in main loop More...
 
void readAvr ()
 read the values for couple of iterations for a smoother value and send a midi message if the fader or knob state changed. use in main loop More...
 
int readValue (bool &changed)
 read and return the analog value, pass state change More...
 
int readValueAvr (bool &changed)
 read and return a smooth analog value, pass state change More...
 
void changeSecondary (bool s)
 enable or disable the secondary super knob cc messages More...
 
void bound (int iMin, int iMax)
 map and bound the analog readings to minimum and maximum values, useful for normalizing light or force sensors. More...
 

Detailed Description

Class for handling faders, knobs or other analog input.

Debugging will enable output to the serial instead of MIDI Secondary will send a super knob secondary CC message Mapped values will be constrained and normalized to the min and max values

Constructor & Destructor Documentation

Potentiometer::Potentiometer ( byte  p)

constructor with pin number.

Parameters
panalog pin number
Potentiometer::Potentiometer ( byte  p,
byte  c,
byte  n 
)

constructor with pin number, midi channel and cc number .

Parameters
ppin number
cmidi channel
ncc number
Potentiometer::Potentiometer ( byte  p,
byte  c,
byte  n,
bool  sec 
)

constructor with pin number, midi channel, cc number and secondary super knob.

Parameters
ppin number
cmidi channel
ncc number
secenable super knob
Potentiometer::Potentiometer ( byte  p,
byte  c,
byte  n,
bool  sec,
bool  debug 
)

constructor with pin number, midi channel, cc number, secondary super knob and debugging.

Parameters
ppin number
cmidi channel
ncc number
secenable super knob
debugenable debugging
Potentiometer::~Potentiometer ( )

Member Function Documentation

void Potentiometer::bound ( int  iMin,
int  iMax 
)

map and bound the analog readings to minimum and maximum values, useful for normalizing light or force sensors.

Parameters
iMinthe value below everything will be set as 0
iMaxthe value above everything will be set as 127
void Potentiometer::changeSecondary ( bool  s)

enable or disable the secondary super knob cc messages

Parameters
senable super knob
void Potentiometer::read ( )

read the values and send a midi message if the fader or knob state changed. use in main loop

void Potentiometer::readAvr ( )

read the values for couple of iterations for a smoother value and send a midi message if the fader or knob state changed. use in main loop

int Potentiometer::readValue ( bool &  changed)

read and return the analog value, pass state change

Parameters
changedwill beset to true if the state of the value changed from last time
int Potentiometer::readValueAvr ( bool &  changed)

read and return a smooth analog value, pass state change

Parameters
changedwill beset to true if the state of the value changed from last time

The documentation for this class was generated from the following files: