Measure time on a jump plate

Hello community

First time on this forum. Just bought a startup kit for arduino.

My idea is to use the arduino to measure time on a jump plate.

The function for the jump plate is that a person stands on a aluminium plate that will connect to a plate under. When he jump vertical, the plate will separate an the time measure will start measure untill the person land and the plate connects again. I have done a code but it doesnt work as a wish.

pinMode(8, INPUT); Is the button. Use as a reset button

pinMode(9, INPUT); Is connected to the plates

I dont want the time to be able to start until the person stands at the plate and I push the button.

The “Start the test” seems to be in a loop i dont want.

Can someone help me.

#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

#define I2C_ADDR    0x27 
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7

int n = 1;

LiquidCrystal_I2C	lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup()
{
  lcd.begin(16, 2);
  lcd.clear();
  // Switch on the backlight
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
lcd.home (); // go home
  
  Serial.begin(9600);
  
  pinMode(8, INPUT);
  digitalWrite(8, HIGH);
  pinMode(9, INPUT);
  digitalWrite(9, HIGH);
 // pinMode(10, INPUT);
 // digitalWrite(10, HIGH);
  
}

double i = 0;
double a = millis();
double c ;
void loop()
{
  lcd.clear();
  lcd.print("Start the test");
  lcd.setCursor(0,2);
    lcd.print("Press button");
  //delay(100);
  if(digitalRead(9) == HIGH)
{
    if(digitalRead(8) == HIGH)
    {
      lcd.clear();
      a = millis();
      while(digitalRead(9) == HIGH)
       {
         c = millis();
         i = (c - a) / 1000;
         lcd.setCursor(0,1);
         lcd.print(i);
         lcd.setCursor(11,0);
         lcd.print("Sec's");
         lcd.setCursor(0,0);
         Serial.println(c);
         Serial.println(a);
         Serial.println(i);
         Serial.println("......");
         //delay(100);
       }
   
      if(digitalRead(9) == LOW)
        {
         while(digitalRead(8) == HIGH)
        {
       lcd.setCursor(0,0);
       lcd.print(i);
       lcd.setCursor(11,0);
       lcd.print("Sec's");
       lcd.setCursor(0,0);
       //delay(100);
     }
   }

 }
  
}

}

Please give us a drawing of how you have the circuit wired and a description of what it does or does not do as you wish.

Weedpharma

I have updated my code and make an diagram.

A want the red LED to light when nobody stands on the aluminium plate. When a person stands on the plate the red LED will be OFF and the blue LED will light and when I press the button the LED green will light. I whan to measure the time the person is in the air.

I cant get it to wort. Can somebody help me

#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

#define I2C_ADDR    0x27 // <<----- Add your address here.  Find it from I2C Scanner
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7

int n = 1;

LiquidCrystal_I2C	lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup()
{
  lcd.begin(16, 2);
  lcd.clear();
  // Switch on the backlight
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
lcd.home (); // go home
  
  Serial.begin(9600);
  pinMode(7, OUTPUT);
  digitalWrite(7, LOW);
  pinMode(8, INPUT);
  digitalWrite(8, HIGH);
  pinMode(9, INPUT);
  digitalWrite(9, HIGH);
  pinMode(12, OUTPUT);
  digitalWrite(12, HIGH);
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);
  lcd.print("Start the test");
  lcd.setCursor(0,2);
  lcd.print("Press button");
  //delay(100); 
}

double i = 0;
double a = millis();
double c ;
void loop()
{
  if(digitalRead(8) == LOW)
  {
    digitalWrite(8, LOW);
    digitalWrite(12, LOW);
    digitalWrite(13, HIGH);
    if(digitalRead(9) == HIGH)
     //lcd.clear();
    {
    digitalWrite(7, HIGH);  
      lcd.clear();
      a = millis();
      while(digitalRead(9) == HIGH)
       {
         c = millis();
         i = (c - a) / 1000;
         lcd.setCursor(0,1);
         lcd.print(i);
         lcd.setCursor(11,0);
         lcd.print("Sec's");
         lcd.setCursor(0,0);
         Serial.println(c);
         Serial.println(a);
         Serial.println(i);
         Serial.println("......");
         //digitalWrite(8, HIGH);
         
       }
 
     

 }
  
}

}

schema.pdf (303 KB)

Hello.

Cant find my topic so I do it again.

I am going to make an contact plate/Jump plate.

The function for the jump plate is that a person stands on a aluminium plate that will connect to a plate under. When he jumps vertical, the plate will separate an the time measure will start measure untill the person land and the plate connects again. I have done a code but it doesnt work as a wish.

I want to use three LED diods:
A want the red LED to light when nobody stands on the aluminium plate. When a person stands on the plate the red LED will be OFF and the blue LED will light and when I press the button the LED green will light.

One problem I have is that I need to press the button the hole test. I want to press it and release and the it will stay LOW. I have tried “digitalWrite(8, LOW);” but…

#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

#define I2C_ADDR    0x27 
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7

int n = 1;

LiquidCrystal_I2C	lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup()
{
  lcd.begin(16, 2);
  lcd.clear();
  // Switch on the backlight
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
lcd.home (); // go home
  
  Serial.begin(9600);
  pinMode(7, OUTPUT);
  digitalWrite(7, LOW);
  pinMode(8, INPUT);
  digitalWrite(8, HIGH);
  pinMode(9, INPUT);
  digitalWrite(9, HIGH);
  pinMode(12, OUTPUT);
  digitalWrite(12, HIGH);
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);
  lcd.print("Start the test");
  lcd.setCursor(0,2);
  lcd.print("Press button");
  //delay(100); 
}

double i = 0;
double a = millis();
double c ;
void loop()
{
  if(digitalRead(8) == LOW)
  {
    digitalWrite(8, LOW);
    digitalWrite(12, LOW);
    digitalWrite(13, HIGH);
    if(digitalRead(9) == HIGH)
     //lcd.clear();
    {
    digitalWrite(7, HIGH);  
      lcd.clear();
      a = millis();
      while(digitalRead(9) == HIGH)
       {
         c = millis();
         i = (c - a) / 1000;
         lcd.setCursor(0,1);
         lcd.print(i);
         lcd.setCursor(11,0);
         lcd.print("Sec's");
         lcd.setCursor(0,0);
         Serial.println(c);
         Serial.println(a);
         Serial.println(i);
         Serial.println("......");
         //digitalWrite(8, HIGH);
         
       }
 
     

 }
  
}

}

schema.pdf (303 KB)

DO NOT CROSS-POST, CROSS-POSTING WASTES TIME.

Why is that so hard to understand?

Threads merged.