“Time-lapse Photography”的版本间的差异

来自Microduino Wikipedia
跳转至: 导航搜索
(Created page with "{{Language| Time-lapse Photography}} {| style="width: 800px;" |- | ==Objective == Use the key to set the time delay and take pictures with SONY camera after the setting. ==Pr...")
 
Software Debugging软件调试
 
第32行: 第32行:
 
[[File:ir_transmitter.jpg|600px|center|thumb]]
 
[[File:ir_transmitter.jpg|600px|center|thumb]]
  
==Software Debugging软件调试==
+
==Software Debugging==
 
*Infrared remote control encoding definition. Here we adopt SONY encoding format.  
 
*Infrared remote control encoding definition. Here we adopt SONY encoding format.  
 
<source lang="cpp">
 
<source lang="cpp">

2015年10月20日 (二) 06:45的最新版本

Language English

Objective

Use the key to set the time delay and take pictures with SONY camera after the setting.

Principle

Here we can set the time delay by detecting how many times you press the key and use the infrared transmission sensor to control SONY camera.

Equipment

Module Number Function
Microduino-CoreUSB 1 Core board
Microduino-Sensorhub 1 Sensor pin board
Microduino-IR transmitter 1 Infrared transmission sensor
Microduino-Crash 1 Crash sensor


Hardware Buildup

  • Setup 1:Stack CoreUSB and Sensorhub together.。
  • Setup 2:Connect the infrared transmitter to the D8 pin of Sensorhub and the crash sensor to the D2 pin of Sensorhub.
Microduino-sensorhub rule.JPG

Software Debugging

  • Infrared remote control encoding definition. Here we adopt SONY encoding format.
#define PHOTO 0xB4B8F     //SONY camera ending 
#define KEY 2             //Key interface

boolean keyFlag = false;  //Key flag  
unsigned long timeFlag = 0;   //Time flag 
int delayTime = 0;

IRsend irsend;
  • Judge how many time you press the key. If you can't detect the next press-down within one second of the last press-down, it means you've finished pressing down. Then, after delaying for a certain period of time, it'll send photo encoding and control the camera to take photos.
  if((millis()> timeFlag+1000)&&delayTime>0)     // Judge how many time you press the key. If you can't detect the next press-down within one second of the last press-down, it means you've finished pressing down.
  {
    delay(delayTime*1000);                      //Set the delay time according to how many times you press down.

    for (int i = 0; i < 3; i++) 
    {
      irsend.sendSony(PHOTO, 20);               //Send photographing instruction 
      delay(10);
    }
    Serial.println("take photo"); 
    delayTime = 0; 
  }
  
  if(keyFlag==false && digitalRead(KEY)==LOW)   //Judge if the key is pressed down. 
  {
    keyFlag = true;
  }
  else if(keyFlag==true && digitalRead(KEY)==HIGH)    //Judge if the key is released. 
  {
    delayTime++;                            //The time of pressing the key+1
    timeFlag = millis();
    keyFlag=false;
  }
  delay(100);

Program

[MicroduinoDelayPhoto]

Result

Align the infrared transmission sensor to the infrared receiving head of the camera, set remote control mode, press the key for several times and then take pictures after a while.

Video