timka21213: (Default)
[personal profile] timka21213


http://vk.com/album179607_155486524

Скетч:

#include <multiCameraIrControl.h>

#define CAMERA_FLASH_PIN 4
#define LASER_THRESHHOLD 650
#define LASER_TRIGGER_ANALOG_PIN 0  

int latchPin = 8;  
int clockPin = 12;  
int dataPin = 11;  

Olympus E420(10);

const byte numbers[10] = 
{ 
  0b10111111, //0 
  0b10000110, //1 
  0b11011011, //2 
  0b11001111, //3 
  0b11100110, //4 
  0b11101101, //5 
  0b11111101, //6 
  0b10000111, //7 
  0b11111111, //8 
  0b11101111, //9 
};

void setup() {  
  pinMode(latchPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);  
  pinMode(dataPin, OUTPUT);  
  pinMode(CAMERA_FLASH_PIN, OUTPUT);  
  digitalWrite(CAMERA_FLASH_PIN, LOW);  
  Serial.begin(9600);
}  

void loop() {  
  // start countdown
  for (int numberToDisplay = 10; numberToDisplay >= 0; numberToDisplay--) {  
    digitalWrite(latchPin, LOW);  
    shiftOut(dataPin, clockPin, MSBFIRST, numbers[numberToDisplay]);    
    digitalWrite(latchPin, HIGH);
    if (numberToDisplay>0) 
    {
      // next count
      delay(1200);
    }
    else 
    {
      // open shutter for five seconds
      E420.shutterNow();
      // delay a second before get ready
      delay(1000);
      // ready for shut
      digitalWrite(latchPin, LOW);  
      shiftOut(dataPin, clockPin, MSBFIRST,  0b1000000);    
      digitalWrite(latchPin, HIGH);
    }  
  }  

  // wait for laser beam interruption
  int laserVal = 0;
  while (laserVal < LASER_THRESHHOLD)  
  {  
    laserVal = analogRead(LASER_TRIGGER_ANALOG_PIN);  
    //  Serial.println(laserVal);
  }
  // laser beam was interrupted, wait a free fall delay then flash
  delay(200);
  digitalWrite(CAMERA_FLASH_PIN, HIGH);  
  delay(1);  
  digitalWrite(CAMERA_FLASH_PIN, LOW);  
}

From:
Anonymous( )Anonymous This account has disabled anonymous posting.
OpenID( )OpenID You can comment on this post while signed in with an account from many other sites, once you have confirmed your email address. Sign in using OpenID.
User
Account name:
Password:
If you don't have an account you can create one now.
Subject:
HTML doesn't work in the subject.

Message:

 
Notice: This account is set to log the IP addresses of everyone who comments.
Links will be displayed as unclickable URLs to help prevent spam.

Profile

timka21213: (Default)
timka21213

December 2016

S M T W T F S
    123
45678910
11121314151617
18192021222324
252627 28293031

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 20th, 2017 02:42 pm
Powered by Dreamwidth Studios