@ -192,7 +192,7 @@ void setuptime() {
}
delay ( 250 ) ;
unsigned long oldtime = 0 ;
unsigned long secper 5 = now ( ) ;
unsigned long secper 20 = now ( ) ;
check = false ;
while ( 1 = = 1 ) {
time_t t = now ( ) ;
@ -212,7 +212,7 @@ void setuptime() {
//Serial.println(distance);
if ( distance < 30 | | analogRead ( 3 ) > = 1 50 | | digitalRead ( 7 ) = = 1 | | digitalRead ( 6 ) = = 1 ) {
if ( distance < 30 | | analogRead ( 3 ) > = 1 2 5 | | digitalRead ( 7 ) = = 1 | | digitalRead ( 6 ) = = 1 ) {
digitalWrite ( 10 , HIGH ) ;
wait = now ( ) ;
}
@ -232,11 +232,17 @@ void setuptime() {
if ( now ( ) ! = oldtime ) {
//if(check == false) {
//Serial.println(analogRead(3));
if ( now ( ) - 350 > = secper5 ) {
t = t + 1 ;
secper5 = now ( ) ;
if ( now ( ) - 1200 > = secper20 ) {
if ( now ( ) - 15 > = wait & & analogRead ( 3 ) < 100 ) {
digitalWrite ( 10 , LOW ) ; // just in case the arduino skips a second at the wrong time
}
if ( day ( t ) ! = oldday ) {
today = 0 ;
}
setTime ( now ( ) + 1 ) ;
secper20 = now ( ) ;
}
if ( now ( ) - 15 > = wait & & analogRead ( 3 ) < 150 ) {
if ( now ( ) - 15 > = wait & & analogRead ( 3 ) < 1 0 0) {
digitalWrite ( 10 , LOW ) ;
}
if ( day ( t ) ! = oldday ) {
@ -258,7 +264,7 @@ void setuptime() {
lcd . print ( " PM " ) ;
} */
if ( analogRead ( 3 ) < 1 50 & & prevphoto > = 15 0) {
if ( analogRead ( 3 ) < 1 00 & & prevphoto > = 10 0) {
last = now ( ) ;
lastlong = now ( ) ;
today + + ;