"multiple timers "

hello everybody :slight_smile: Im new in arduino world and before I write my question excuse me for my english.

I want to make 10 buttons to be inputs on arduino_one, every button is start and stop for its own
‚Äústopwatch‚ÄĚ and that arduino_one sends that time over rf 433 to arduino_two.
Arduino_two then receives that 10 times and compare its to threshold of 90sec if any time is biger then threshold then arduino_two print that time to LCD and print ‚Äúlap time‚ÄĚ to pc over serial and next to that time lap actual time meaning date and time.
As now:
I have no idea how to get ‚Äútimestamp‚ÄĚ
have only one ‚Äústopwatch‚ÄĚ
On serial i get time every second not the ‚Äúlap time‚ÄĚ start-stop time.

I have figured out lcd print of the time and if time is biger then threshold serial output is displayed.
I found a way to recognize 10 times over rf433 by changing bitlenght //

if (mySwitch.available()) {
  
  
if (( mySwitch.getReceivedBitlength()) == 32 ){""

code of sending arduino_one

#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();


const int buttonPin = 9;    // the number of the pushbutton pin
const int ledPin = 13;      // the number of the LED pin
const int ledica = 11;

int ledState = HIGH;         // the current state of the output pin
int buttonState;             // the current reading from the input pin
int lastButtonState = LOW;// the previous reading from the input pin

unsigned long vrijeme = 0;
unsigned long lastDebounceTime = 0;  // the last time the output pin was toggled
unsigned long debounceDelay = 50;    // the debounce time; increase if the output flickers

void setup() {
 pinMode(buttonPin, INPUT);
 pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
  pinMode(ledica, OUTPUT);
 // set initial LED state
 digitalWrite(ledPin, ledState);
 mySwitch.enableTransmit(10);
}

void loop() {
 // read the state of the switch into a local variable:
 int reading = digitalRead(buttonPin);

 // check to see if you just pressed the button 
 // (i.e. the input went from LOW to HIGH),  and you've waited 
 // long enough since the last press to ignore any noise:  

 // If the switch changed, due to noise or pressing:
 if (reading != lastButtonState) {
   // reset the debouncing timer
   lastDebounceTime = millis();
 } 
 
 if ((millis() - lastDebounceTime) > debounceDelay) {
   // whatever the reading is at, it's been there for longer
   // than the debounce delay, so take it as the actual current state:

   // if the button state has changed:
   if (reading != buttonState) {
     buttonState = reading;

     // only toggle the LED if the new button state is HIGH
     if (buttonState == HIGH) {
       ledState = !ledState;
     }
   }
 }
 
 // set the LED:
 digitalWrite(ledPin, ledState);

 // save the reading.  Next time through the loop,
 // it'll be the lastButtonState:
 vrijeme = (millis() - lastDebounceTime);
 lastButtonState = reading;
 vrijeme_loop();
seriski_ispis();
 
}

void vrijeme_loop(void)
{
 
   Serial.print(vrijeme/1000);
   (mySwitch.send((vrijeme/1000) ,32));

 }
 
 void seriski_ispis(void)
 {
    if (vrijeme/1000 > 10)
    {
      digitalWrite(ledica, HIGH);
      }
      else{
        digitalWrite(ledica, LOW);
        }
    }

code of reciver arduino_two

/

*
 Simple example for receiving
 
 http://code.google.com/p/rc-switch/
*/

#include <RCSwitch.h>
#include <LiquidCrystal.h>

RCSwitch mySwitch = RCSwitch();
LiquidCrystal lcd(7, 6, 5, 4, 3, 8);

unsigned long time=0;
const int led = 13;

void setup() {
 Serial.begin(9600);
 mySwitch.enableReceive(0);  // Receiver on inerrupt 0 => that is pin #2
 lcd.begin(16, 2);
 pinMode(13, OUTPUT);
}

void loop()
{   
read_data(); 
lcd_display();

  



}

//**********************************************************

void read_data(void) 
{
  
 
   if (mySwitch.available()) {
  
  
if (( mySwitch.getReceivedBitlength()) == 32 ){
 
unsigned long  time1 = mySwitch.getReceivedValue();
 time = time1;
    
 }

   
    
 }
if (time > 90){
 digitalWrite(led, HIGH);
   Serial.print("1600/2: ");
   Serial.print(time);
   Serial.print('\n');
   
 }
 else{
   digitalWrite(led, LOW);
   }
}
//***************************************************

void lcd_display()
{
 lcd.setCursor(0, 0);
lcd.print("1600/2");
lcd.setCursor(0, 1);
 
 lcd.print("time pased");
lcd.print(time);
delay(300);
lcd.clear();


}

//**************************

You can easily get time stamps by recording the value of millis() whenever a button is pressed. You could have an array of 10 start values and another array of 10 stop values. And maybe, for convenience, an array of 10 differences - i.e. the elapsed times.

Is it really necessary to use two Arduinos - that seems to add a lot of extra code.

However sending values from one to the other should be straightforward. Just iterate through the array and send the 10 values.

I imagine the examples in serial input basics can be adapted for receiving data on your system.

...R

Cross posted in programming questions

zmay2509: I have no idea how to get "timestamp"

I have no idea why you do cross-posting in this forum while the forum rules forbid cross-posting.

So perhaps you better first let a moderator merge your cross-postings into one thread. Then perhaps I will post a useful answer.

Cross-postings are just wasting time of moderators and time of people who are willing to help in this forum.