Midi controller 4 pots on one LCD

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

Copy the one pot activity and quadruple it. Update the display positions for the pots.

Show what You've found.

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..

Simple Yes.

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.

1 Like

thank you so much for the help. this is exactly what i was looking for. this example will help me understand a little more.

how do i change to values to percentage ?

something like = map(p1, 0, 1023, 0, 100); ?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.