Hi folks,
I'm really a newbie here so I need help. Here are my electronics:

so I need this:
when first button is pressed it will record everything what is pressed by the third button,
when second button is pressed it will play what first button recorded previously.
Any ideas?
Do you need to keep the first button pressed whilst recording ?
What exactly do you want to record ? Button press and button release times would seem obvious but is that right ?
Start small. Do you know how to read the input from a button ?
No I don't need to keep first button pressed. I searched about that topic also, but as I said at begining I'm noob at programming. Debouncing was one of the solutions for not holding button while recording.
I want to record i.e. sequence like 00010110010001110 and just want to repeat it.
I want to learn about this so if anyone knows please comment, there is nothing much on the internet. I was searching for 2 days and so far this is where I am.
I want to record i.e. sequence like 00010110010001110
Taking the sequence 000 as an example, has the third button been released 3 times and if so why no 1s between them ? Or do you perhaps mean that the state of button 3 will be sampled at regular intervals and its state at that time recorded ?
As a matter of interest, how many button presses do you envisage recording ?
In this case sequence will be equivalent to time interval.
Maybe this could be done with some other method.
Thank you for helping
OK, let's go back to basics.
Do you know how to read the state of an input ? If not, then look at the Button example in the IDE.
Than you for helping me.
This is how far I got today
the code is here:
int rec =13;
int play =10;
int button =2;
int led =4;
int counter = 0;
int buttonstate1 = 0;
int buttonstate2 = 0;
int didipress = 0;
int amirecording = 0;
void setup(){
pinMode(rec, INPUT);
pinMode(play, INPUT);
pinMode(button, INPUT);
pinMode(led, OUTPUT);
}
void loop(){
didipress = digitalRead(button);
amirecording = digitalRead(rec);
if (didipress == true && amirecording == true){
digitalWrite(led, HIGH);
} else {
digitalWrite(led, LOW);
}
}
I know that I need to count time, but I'm not very good at arrays.
In reply #2 you said
No I don't need to keep first button pressed.
But the code that you posted does not take account of that. The variable named didipress would be better named isTheButtonPressedAtThisMoment
Start small. Write a program that sits in the loop() function until the start button becomes pressed rather than is pressed (see the StateChangeDetection example in the IDE) and when it does, start reading the button to be recorded and turn on the LED when it is pressed. In the same section of program check whether the playback button has become pressed and if it has go back to waiting for the record button to become pressed.
Once this is working you can think about adding the actual recording and playback functions.