Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ArduinoHAL mbed-src-nrf51822
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:
-
p analog 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:
-
p pin number c midi channel n cc 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:
-
p pin number c midi channel n cc number sec enable 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:
-
p pin number c midi channel n cc number sec enable super knob debug enable 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:
-
iMin the value below everything will be set as 0 iMax the 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:
-
s enable 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:
-
changed will 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:
-
changed will beset to true if the state of the value changed from last time
Definition at line 98 of file Potentiometer.cpp.
Generated on Thu Jul 14 2022 04:36:10 by
