Well I spent hours writing a program to operate a video camera to film the 'Badger' only to find out that the video camera after five minutes powers down and a switch has to be pushed up to re-activate into record mode and then the record button pressed. So a non starter after all that.
I then hooked out my old but simple digital stills camera and re-wrote the program to activate that.The camera stays 'on' when powered up using the mains adaptor
so no power down problem and I've turned the LCD display off.
All I need to do now is make a simple board up for the PIC (It's on breadboard at the moment) and I should be in business tomorrow night.
Probably not the most accurate program ever written, then again I couldn't turn an LED on this February
anyway here's the code:
Code:
ANSEL = %00000000 'Disable analog select so ports work as digital i/o.
CMCON0 = %00000111 'Disable analog comparators.
TRISA = %00000000 'Set PORTA as OUTPUT.
PORTA = %00000000 'Set PORTA pins all low.
TRISC = %00001000 'Set PORTC.0 as INPUT.
PORTC = %00000000 'Set PORTC pins all low.
x var byte 'Loop counter Variable
Servo var PORTC.1 'Servo control output_pin
PORTC = 0 'Setup for high_pulsout
MAIN:
PAUSE 50
FOR X = 1 TO 20
PULSOUT Servo,180 'Set the Servo_Arm_Pos (Ready to take a picture)
PAUSE 20
NEXT X
LOOP1:
PAUSE 50
IF PORTC.3 = 0 THEN FIRE: 'PIR Activated (Badger present?)(N/C Contacts opened).
IF PORTC.3 = 1 THEN LOOP1:'PIR Not activated loop until it is.
FIRE: 'Take a picture routine
PAUSE 50
FOR X = 1 TO 20
pulsout servo,130 'Servo_arm moves cable release to take picture
PAUSE 50
NEXT X
pause 1000 'Time for shutter to fire
FOR X = 1 TO 20 'Cable release for camera released / picture taken
PULSOUT Servo,180 'Servo_arm moves back releases cable release
PAUSE 50
NEXT X
PAUSE 10000 'Wait 10 sec's for Camera flash to recycle / recharge
goto LOOP1:
What do you think?
Dave
Bookmarks