New
New
int x;
int y;
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
if(s<x){x=s;}
// print out the value you read:
Serial.print(s);
Serial.print(" ");
Serial.println(x);
delay(1); }
////////////////
for ( int i = 0 ; i <10 ; i++ ) {
Serial.println("vvvvvv");
time = millis ( ) ;
time1= time;
}
for ( int i = 0 ; i < 400 ; i++ ) {
int s = analogRead(A5);
time = millis ( ) ;
if(s<y){y=s;}
if (y<x-50){time2=time; //digitalWrite (13,0) ;
time3=(time2-time1);
i=401;
}
// print out the value you read:
Serial.print(time3);
Serial.print(" ");
Serial.print(s);
Serial.print(" ");
Serial.print(x);
Serial.print(" ");
Serial.println(y);
delay(1); }
delay(5000);
/////////////
if (x==0){ // Serial.print("*y"+String(60/(time3/1000))+"*");
// Serial.println(60/(time3/1000));
tone ( 2 , 500, 100 ) ;
time1=time;
//digitalWrite (13,1) ;
}
if(x==0){
time2=time; //digitalWrite (13,0) ;
time3=(time2-time1); }