Joro Bandakov / Potentiometer

Dependencies:   ArduinoHAL mbed-src-nrf51822

Embed: (wiki syntax)

« Back to documentation index

Potentiometer Class Reference

Potentiometer Class Reference

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

#include <Potentiometer.h>

Public Member Functions

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

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

Definition at line 19 of file Potentiometer.h.


Constructor & Destructor Documentation

Potentiometer ( byte  5 )

constructor with pin number.

Parameters:
panalog pin number

Definition at line 11 of file Potentiometer.cpp.

Potentiometer ( byte  5,
byte  c,
byte  n 
)

constructor with pin number, midi channel and cc number .

Parameters:
ppin number
cmidi channel
ncc number

Definition at line 16 of file Potentiometer.cpp.

Potentiometer ( byte  5,
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

Definition at line 21 of file Potentiometer.cpp.

Potentiometer ( byte  5,
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

Definition at line 26 of file Potentiometer.cpp.


Member Function Documentation

void 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

Definition at line 80 of file Potentiometer.cpp.

void changeSecondary ( bool  s )

enable or disable the secondary super knob cc messages

Parameters:
senable super knob

Definition at line 153 of file Potentiometer.cpp.

void read (  )

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

Definition at line 43 of file Potentiometer.cpp.

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

Definition at line 59 of file Potentiometer.cpp.

int 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

Definition at line 89 of file Potentiometer.cpp.

int 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

Definition at line 98 of file Potentiometer.cpp.