ARDUINO

C++

Arduino high speed trigger

Gert Smilde: Canon en flitsers
Bertil Sierink: Arduino & C++

mogelijkheden bespreken?
C++

Arduino high speed trigger

Arduino Mega
C++

mogelijkheden bespreken?

 

M U L T I- T R I G G E R   –  B E R T I L S I E R I N K.NL

This code is designed: Woensdag 11 Januari 2012.

Define triggers

#define ENABLE_SOUND_TRIGGER
#define ENABLE_LASER_TRIGGER
#define LASER_THRESHHOLD 500
#define SOUND_THRESHHOLD 50
#define CAMERA_FLASH_PIN 30
#define LASER_PIN 5
#define LED_PIN 31
#define LASER_TRIGGER_ANALOG_PIN 1
#define SOUND_TRIGGER_ANALOG_PIN 0
void setup()
{
pinMode(CAMERA_FLASH_PIN, OUTPUT);
digitalWrite(CAMERA_FLASH_PIN, LOW);
pinMode(LASER_PIN, OUTPUT);
digitalWrite(LASER_PIN, LOW);

#ifdef ENABLE_LASER_TRIGGER
digitalWrite(LASER_PIN, HIGH);
#endif

#ifdef PRINT_MESSAGES
Serial.begin(9600); open serial
#endif
}

void loop()
{
int soundVal;
int laserVal;

SOUND TRIGGER
#ifdef ENABLE_SOUND_TRIGGER
soundVal = analogRead(SOUND_TRIGGER_ANALOG_PIN);
if (soundVal > SOUND_THRESHHOLD)
{
delay(0000); // wait for …. MS to trigger the flash

DELAY
digitalWrite(CAMERA_FLASH_PIN, HIGH);
#ifdef PRINT_MESSAGES
Serial.println(“Flash Triggered!!!”);
#endif
delay(5000);
TIME – OUT
digitalWrite(CAMERA_FLASH_PIN, LOW);
}
#ifdef PRINT_MESSAGES
Serial.print(“Sound: “);
Serial.println(soundVal, DEC);
#endif
#endif

ENABLE_SOUND_TRIGGER

LASER TRIGGER

#ifdef
ENABLE_LASER_TRIGGER
laserVal = analogRead(LASER_TRIGGER_ANALOG_PIN);
if (laserVal < LASER_THRESHHOLD
{
delay(200);
wait for …. MS to trigger the flash
digitalWrite(CAMERA_FLASH_PIN, HIGH);
digitalWrite(LASER_PIN, LOW);
Turn off laser during picture
#ifdef PRINT_MESSAGES
Serial.println(“Flash Triggered!!!”);
#endif
delay(100);
digitalWrite(CAMERA_FLASH_PIN, LOW);
digitalWrite(LASER_PIN, HIGH);
Turn laser back on after picture
}
#ifdef PRINT_MESSAGES
Serial.print(“Laser: “);
Serial.println(laserVal, DEC);
#endif
#endif
ENABLE_LASER_TRIGGER
}