hello im pretty new to arduino and i built a midi controller with 4 potentiometes using a arduino micro.
im looking to improve my project to include a lcd display with information about the potentiometers values in percentages. i only find videos and info about one potentiometer. is it possible to use it with 4 potentiometers andes and 1 display that interchanges the info, wipes the previous pot info when another is used ? all help would be welcome
A common 2-line LCD can display 16 characters per line. Displaying two (or three) pot values per line and periodically refreshing the values is not a problem.
Leo..
if you really want to just only show the last changed value, you should remember the measured value after you have printed it to the LCD.
Just as an idea:
//https://forum.arduino.cc/t/midi-controller-4-pots-on-one-lcd/1190027
#include <LiquidCrystal_I2C.h> // if you don´t have I2C version of the display, use LiquidCrystal.h library instead
LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display
// define your input data
struct Input {
const uint8_t pin; // the ADC pin you want to measure
uint16_t previousValue; // store the old value
};
// define your inputs
Input input[] {
{A0, 0},
{A1, 0},
{A2, 0},
{A3, 0},
};
constexpr uint8_t threashold = 3;
void setup() {
lcd.init(); // initialize the 16x2 lcd module
lcd.backlight(); // enable backlight for the LCD module
lcd.println(F("Measure ADC"));
delay(500); // show startup message
}
void loop() {
for (auto &i : input) {
// Input
int currentValue = analogRead(i.pin);
// Process
int difference = currentValue - i.previousValue;
difference = abs(difference);
// Output
if (difference >= threashold) {
lcd.setCursor(0, 0);
lcd.print(F("ADC pin"));
lcd.print(i.pin);
lcd.print('=');
lcd.print(currentValue);
lcd.print(F(" ")); // delete "old" remaining characters
i.previousValue = currentValue;
}
}
}
as the ADC might not be very stable, it could be that you have to define a threshold.