PBPotentiometer Invert #820
-
Hi, I see the PBPotentiometer has the option of inverting the output, I wired mine backwards and it works, but I'd like to invert the output without changing the wiring and I'm not sure how to get it to work. I don't know much about coding, but I did write this from examples and everything else is working. #include <Control_Surface.h> // Include the Control Surface library
#include <MIDI_Outputs/CCButtonLatching.hpp>
#define LED 14 // The pin the LED is connected to
// Instantiate a MIDI over USB interface.
USBMIDI_Interface midi;
// Instantiate a PBPotentiometer object
PBPotentiometer potentiometer {
A6, // Analog pin connected to potentiometer
CHANNEL_1, // MIDI Channel 1
};
CCPotentiometer pots[] {
{A0, 7},
{A1, 10},
{A2, 112},
{A3, 113},
{A7, 114},
{A8, 115},
//{A9, 116},
{A10, 117},
};
// Instantiate a CCButton object
CCButtonLatching button {
// Push button on pin 5:
2,
// General Purpose Controller #1 on MIDI channel 1:
{MIDI_CC::General_Purpose_Controller_1, CHANNEL_1},
};
void setup() {
Control_Surface.begin(); // Initialize Control Surface
pinMode(LED, OUTPUT); // Declare the LED as an output
}
void loop() {
Control_Surface.loop(); // Update the Control Surface
digitalWrite(LED, LOW); // Turn the LED on
} |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
You can add the line |
Beta Was this translation helpful? Give feedback.
-
hello, is it possible to have this function for an encoder to revert it? |
Beta Was this translation helpful? Give feedback.
-
I can t access it with the library using mcp23017, or I m missing something? |
Beta Was this translation helpful? Give feedback.
-
Hi, To begin, let's me thank Tttapa for his great job. I've built a real control surface with no difficulties. This control surface is use with Synth1 VST: It work very fine, with a little exception: all my potentiometers is inverted and analog read value too... And modify these problems is not easy: All my potentiometer is welded with the copper tape... Where and how i must correct the code ? i take two days to find the answers and the syntax on the wonderful Control surface documentations. But without clear explaination... But i'm a newbie, sorry I've just read 30 minutes ago the "potentiometer.invert();" fonction, but i do not know how and where to code it. Here my code: ` // Select the serial port to use. // Instantiate an analog multiplexer CCPotentiometer Potentiometers1[] { CD74HC4067 mux2 { CCPotentiometer Potentiometers2[] { CD74HC4067 mux3 { CCButton button [] { CCAbsoluteEncoder enc [] { }; CCPotentiometer pot [] { { A4, { 91 } }, void setup() { void loop() { With all my thanks for the help. |
Beta Was this translation helpful? Give feedback.
You can add the line
potentiometer.invert();
to the beginning of yoursetup()
function.PBPotentiometer::invert()