• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Fotopułapka do lustrzanki DSLR oparta na AIR i arduino [SOLVED]
#5
Jestem jeleniem Smile
Spróbuj tego. Trzeba dodatkowy transoptor i dobrać opóźnienie tam gdzie zaznaczyłem

Kod:
/*
* Active IR Camera Trap - 5/3/2017
*
*
*  Active IR Sensor DSLR Camera Trap using E18-8MNK transmitter/Receiver pair.
*
* The IR output pin goes to LOW if motion is present.
*
*/

/*-----( Declare Constants )-----*/
#define IRsensor 9    // Active IR Sensor
#define opto 2 // 4n26 optocoupler do migawki
#define focus 3 // 4n26 optocoupler do fokusa

/*-----( Declare Variables )-----*/
int  detector_state;  /* Holds the last state of the switch */
int trigger = 4;

void setup()   /*----( SETUP: RUNS ONCE )----*/
{
  detector_state = 0;               
  pinMode (IRsensor, INPUT );
  pinMode (opto, OUTPUT );
  pinMode (focus, OUTPUT );
 
  Serial.begin(9600);

  Serial.println ("DSLR CritterMaster 1.0b1 - Active IR");
  delay(5000);
  Serial.println ("Ready ");

}
/*--(end setup)---*/

void  loop ()  /*----( LOOP: RUNS CONSTANTLY )----*/
{
  detector_state = digitalRead (IRsensor);
  if ( HIGH == detector_state)
  {
 
    digitalWrite (opto, LOW );
    digitalWrite (focus, LOW );
  }
  else
  {
    for (int x = 0; x < 4; x++)
    {
    digitalWrite (focus, HIGH );
    delay (200); // czas opoznienia w tym wypadku 200 ms nie wiem czy wystarczy
    digitalWrite (opto, HIGH );
    delay (200);
    digitalWrite (focus, LOW );
    digitalWrite (opto, LOW);
    delay (1000);
    Serial.println("Motion detected ");
    }
  }
  delay (100);
}
/* --(end main loop )-- *

* ( THE END ) */
 
  


Wiadomości w tym wątku
RE: Fotopułapka do lustrzanki DSLR oparta na AIR (active infrared beam) i arduino - przez Agregacik - 26-11-2019, 16:31

Skocz do:


Przeglądający: 1 gości