timka21213: (Off!)

timka21213: (Default)


Видеозарисовка Станислава Баха о нашей поездке.
timka21213: (Default)


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);  
}

timka21213: (Default)


Вторая видеозарисовка о нашей поездке.
Page generated Aug. 21st, 2017 10:08 am
Powered by Dreamwidth Studios