Which function do I need?

Hey guys, I'm new to this Arduino thing and I've got a project due in a few days and it's causing me quite a bit of grief. Basically we need to be able to press a button X amount of times and then hit a second button to display the number of times we pressed the button (X) in binary across LED lights. An unlit light representing a 0 and a lit light representing 1, for example, hitting the button 4 times would show the binary equivalent on the LED lights.

I'm not asking for people to do my assignment, but I'd like to know which functions I should be looking at to properly code this thing. Since I'm on a time crunch I'd like help narrowing down my focus.

Any help is appreciated.

So you need to do two things - count button presses and display a binary number on LEDs, right? What do you need help with? Counting seems simple enough, so I'm guessing the binary portion. Look at the binary operators to figure out how to separate out each bit.

Counting seems simple enough

Keep in mind, though, that you don't want to count when the switch IS pressed. Rather, you want to count when the switch BECOMES pressed. The state change detection example illustrates how.

I know next to nothing about Arduino code. I'm looking through Arduino tutorials and it isn't clear to me which function is going to take the number of button presses and store it as an integer that can be converted to some binary light form.

it isn't clear to me which function is going to take the number of button presses and store it as an integer that can be converted to some binary light form.

Declare the counter variable as an int , set it to zero, then every time the button becomes pressedcounter = counter + 1;There are neater ways to write this but this way is easy to read and understand.

Tell us how you would do it in a language that you know. Then we can point out the differences.

This is fairly simple, no function required.

I guess I don't understand how you take the physical input of a button press and do anything with it in code.
If it were Java, I'd do something easy like this:

int buttonCount;
buttonCount = keyboard.nextInt();

How is the button attached to the Arduino? You probably need to look at DigitalRead().

Hint: you probably also need to debounce.

Here is an idea how to count using an interrupt and a button connected on pin digital 2.

int button = 2;
int presses = 0;
long time = 0;
long debounce = 100;

void setup()
{
	pinMode(button, INPUT);
	attachInterrupt(0, count, LOW);
	Serial.begin(9600);
}

void loop()
{
	Serial.println(presses);
}

void count() {
	if(millis() - time > debounce)	presses++;
	time = millis();
}

Update: I wrote this article http://www.electroschematics.com/9809/arduino-8-bit-binary-led/ that displays a decimal number as binary using 8 leds. Hope it is a great inspiration source for your project.