selecting numbers with a potmeter

hello y'all, im doing a project on my own and im trying to make a safe . You have to select 4 numbers ranging from 0-25 . I want to use a potmeter and when u turn the knob it goes through the range of numbers and then confirm the numbers with a button , can anyone help me in the right direction?

thanks in advance

can anyone help me in the right direction?

The right direction would obviously be to use analogRead() to read the potentiometer value and digitalRead() to read the switch states. Of course, this approach presupposes that you know how to connect the switch and potentiometer to the Arduino.

Unless this is a paid job, you better ask a mod to move this to the Project Guidance forum.

PaulS:
The right direction would obviously be to use analogRead() to read the potentiometer value and digitalRead() to read the switch states. Of course, this approach presupposes that you know how to connect the switch and potentiometer to the Arduino.

yea i already got that the serial monitor gives me the numbers from 0-25 but with the selecting part im still lost

So what do you have (post code) and where does it go wrong?

//

wvmarle:
So what do you have (post code) and where does it go wrong?

wvmarle:
So what do you have (post code) and where does it go wrong?

int pMin = 14;
int pMax = 948;
int x = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
x = analogRead(A0);

Serial.print(x);

x = map(x, pMin, pMax, 0, 24);
Serial.print("\t");
Serial.println(x); delay(100);
}

this shows in the serial monitor numbers between 0-25 now i have to write a code that i can select 4 numbers with 4 presses on a button but i have no idea where to start , these 4 numbers work like a password , so when the 4 numbers are correct a green light lights up and if u choose 4 wrong numbers a redlight shows up

Create an array, then upon reading a button press you take an analogRead() and place the number in the array.

byte selectedNumber[4];
byte counter = 0;
void loop() {
  if (digitalRead(BUTTON_PIN) == LOW) {
    int x = analogRead(A0);
    selectedNumber[counter] = map(x, pMin, pMax, 0, 24);
    counter++;
    delay(100); // for button bounce
  }
  if (counter >= 4) {
    do_check_code();
  }
}