how can i confirm my selection using a button

can anybody help? i want to confirm my selection by pressing a button. the selection is a number from my 7 seg display....
can anybody help....URGENTTTTTTTT!!!!!!

1- 7seg display shows number i want
2- press button to confirm selection of number

ANYBODY HELP ME????

Troll...? Must be...

configure a pin as an input with internal pullup resistor enabled. Wire a button to connect the pin to ground.
After your display is set, read the button to see if it went low and go from there.
The button will go 010101010000 a few times (bounce) as you press it, and 10101011111 as you release it, so after you see it change give it a chance to settle before reading it again.
Or use the button library & have it take of debouncing for you.

sorry, im new at the arduino stuff, its for my assignment and so far most of what i have done is stuff from online reading....but its hard to find stuff about this...isit possible for more detailed help maybe something on a noob level? would be highly appreciated

SO SORRY

It's not clear what you wanted. Will the number be changing while you get ready to push the button? You should post your assignment, what university and professor :stuck_out_tongue:
Not getting it is different from not trying it. If you have some code, that is trying, if not, good luck.

the number can be changed using a potentiometer and once you have changed the number to the one you want, i want a button which will confirm the selection....which is also using a beep from a buzzer once it has been confirmed

can anybody help?

i have the potentiometer set with the 7seg display and it changes the numbers when i move it...

What was so hard about what I suggested?
pinMode(select_button, INPUT);
digitalWrite (select_button, HIGH);

put this in the loop as part of twirling your knob
after twirlng knob...

select_button_state = digitalRead (select_button);
if (select_button_state == 0){
// button_pressed =1; // lock in the number

// at the end of your knob twirling loop
if (button_pressed ==1){
// go on to next action
}
something along those lines
}

i have no programming knowledge so it was prety hard for me to understand... thanks allot though...i will give it a go :slight_smile:

How'd you get thru reading the potentiometer and displaying the digits? That is a lot more complex.

online reading plus parts of the 1st section were given i just had to add the else ifs to the allready existing if statement

ok, so just add another if around that:
void loop(){

if (button_pushed_state ==1 && locked_in flag = 0){
do all the digit stuff
read the button again}

else{
// button was pushed and not locked in
locked_in flag =1;
}
// do other code
// when all done:
locked_in flag = 0;

} // end void loop

Sorry quake, after your first post I was convinced that you are just messing with us.

I would like to know, what is your experience level with writing codes, any kind? Just to know where these advices are leading you. Yep, I'm still learning my self C-language, but it is not just writing the code, it's more like thinking the whole or partial prosess in your mind before writing.

Cheers,
Kari

sorry for the late reply guys ive run out of internet at my uni halls....

well ive started uni, 1st year, not been able to go to much of the c programming lectures/lessons as i dnt stay well...so ive missd allot of stuff...but i understand the very basics.....and thats jus begining of C to be honest...

Hi Quake, I have a sneaky suspicion we might go to the same university. (I'm not going to say which for obvious reasons)

So, the code is quite simple. You need to first define your button at the top of the code as something like:

#define BUT 10 (I think they range from 10-13)

In your code you'll need to setup that button as an input which is done in the setup() function.

pinMode(BUT,INPUT);

In the loop() function you'll need to create a variable and then set it to digitalRead(BUT). Use this variable to check if the buttonState == LOW if is it call the game function.

Hopefully that helps! Good luck for this week. :wink:

quake:
the number can be changed using a potentiometer and once you have changed the number to the one you want, i want a button which will confirm the selection....which is also using a beep from a buzzer once it has been confirmed

can anybody help?

i have the potentiometer set with the 7seg display and it changes the numbers when i move it...

I can't work out how to do that !! help!!!