buckshot164

#rem

SONY S600 FAST HACK CODE

Whitetail Whittle
Eagle Eye Video Board
18M2 Picaxe Chip

LENS WIRE USES SPARE MOSFET B.3
TRACE NEEDS TO BE CUT AND JUMPER ADDED BETWEEN MOSFET AND OPTO

15 SECOND DELAY WITH SWITCH 1 ON AND SWITCH 2 ON
1 MINUTE DELAY WITH SWITCH 1 OFF AND SWITCH 2 OFF
3 MINUTE DELAY WITH SWITCH 1 ON AND SWITCH 2 OFF
5 MINUTE DLEAY WITH SWITCH 1 OFF AND SWITCH 2 ON

SWITCH 3 NOT USED (EMPTY)

#endrem

disablebod                
                                
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'18M2 Pin Out

'B.0    switch
'B.1    switch
'B.2    switch
'B.3    spare mosfet
'B.4    Exchanger Power
'B.5    camera shutter
'B.6    camera power
'B.7    mic
'C.0    exchanger
'C.1      exchanger
'C.2     CDS "read light"
'C.3     CDS power
'C.4     program
'C.5    PIR
'C.6    Array
'C.7    LED

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'NAMING PINS

symbol delay_switch1 =  PinB.0
symbol delay_switch2 = PinB.1
symbol switch_not_used = PinB.2
symbol fast_hack_wire = B.3
symbol Exchanger_Power = B.4
symbol shutter = B.5
symbol campwr = B.6
symbol mic = B.7
symbol exchanger_day = C.0
symbol exchanger_night = C.1
symbol cds_read = PinC.2
symbol cds_power = C.3
symbol program = C.4
symbol pir = PinC.5
symbol array = C.6
symbol led = C.7

'NAMING VARIABLES

symbol Walktest_Timer = w9
symbol CameraRefreshTimer = w10        'camera refresh timer
symbol CameraRefreshTime = w11        'how long until camera refreshes
symbol CdsCheckTimer = w12        'Cds timer
symbol CdsCheckTime = w13        'how long until cds needs to be checked
symbol CDS_Value = b1            'value is determined by picaxe
symbol Night_Flag = b1            '1 = night 0 = day
symbol CDS_Day_Night = b2        'cds day/night threshold #
symbol Arm_Blinks = b4             'loop to blink led to show walktest complete

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'SETTING VARIABLES

CDS_Day_Night = 20           
Night_Flag = 1
CameraRefreshTime = 25000    'THIS NUMBER CHANGES HOW LONG UNTIL THE CAMERA REFRESHES (AT NIGHT) (1 HOUR AT 25000 USING NAP3)
CdsCheckTime = 4170        'THIS NUMBER CHANGES HOW LONG UNTIL THE CDS IS CHECKED (APPROX EVERY 10 MINUTES AT 4170 USING NAP3)

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'SETTING INPUTS/OUTPUTS

input b.0
input b.1
input b.2
output b.3
output b.4
output b.5
output b.6
output b.7
output c.0
output c.1
input c.2
output c.3
input c.4
input c.5
output c.6
output c.7

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Camera_Test:

high led                'power on led
sleep 2                    'pause 4 seconds
gosub CamOn                'power camera on
sleep 3                    'turn cam on for 7 seconds
gosub CamOff                'power camera off
low led                    'power off led
pause 500                'pause 500 ms
goto Walk_test                'move to walk test

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Walk_test: 

Walktest_Timer = 300            '300 for 30 second walk test
Do While Walktest_Timer > 0                          
If Pir = 1 then                'if pir detects motion then
high led                'power on led
pause 1000                'keep led on for a 1 second
low led                    'power off led
Walktest_Timer = 300            'reset timer if walk test is interrupted
pause 3000                'wait 3 seconds for pir to settle
endif
Walktest_Timer = Walktest_Timer - 1    'decrease W0 timer by 1                              
pause 100                'pause 100 ms
loop
for Arm_Blinks = 1 to 4            'loop for 4 times to flash led to show walk test complete                                  
high led                'power on red led           
pause 500                'pause 1/2 second
low led                    'turn off led
pause 500                'pause 1/2 second
next Arm_Blinks
sleep 2                      
goto Main                'move to Main

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Main:        'LOOP THAT CHECKS CDS, REFRESHES CAMERA, AND CHECKS FOR MOTION

Do

Nap 3                            'nap for 144ms (THIS IS A MUST FOR PROPER TIMING)

Inc CdsCheckTimer                    'add 1 to CDS check timer
if CdsCheckTimer >= CdsCheckTime then            'if cds check time is reached
gosub CdsChk                        'check cds
CdsCheckTimer = 0                    'reset timer           
endif

if Night_Flag = 1 then                    'IF NIGHT            
Inc CameraRefreshTimer                    'add 1 to camera refresh timer
if CameraRefreshTimer >= CameraRefreshTime then        'if camera refresh timer is reached then
high campwr                        'turn on camera     
pause 300           
low campwr               
sleep 4                            'pause for approx. 9.2 seconds for camera to refresh
high campwr                        'turn off camera
pause 300
low campwr
CameraRefreshTimer = 0                    'reset timer
endif
endif

if Night_Flag = 0 then                    'IF DAY   
CameraRefreshTimer = 0                     'reset timer
endif

Loop until pir = 1
gosub Cam_Functions
goto main

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Cam_Functions:

high fast_hack_wire
gosub CamOn            'power on camera
pause 2000            'pause between power and shutter
gosub Shutterpic     'start recording
sleep 2                'pause after pic taken to save to card
gosub CamOff            'power off camera
low fast_hack_wire

CameraRefreshTimer = 0         'reset timer               

'XXXXXXXXXXX DELAY TIMES XXXXXXXXXXXXXX

if delay_switch1 = 1 and delay_switch2 = 1 then        '16.1 second delay
sleep 7
endif

if delay_switch1 = 0 and delay_switch2 = 0 then        '1 minute delay
sleep 26
endif

if delay_switch1 = 1 and delay_switch2 = 0 then        '3 minute delay
sleep 78
endif

if delay_switch1 = 0 and delay_switch2 = 1 then        '5 minute delay
sleep 130
endif
Return                'return to main loop

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Shutterpic:

high shutter       
pause 500            'pause 500 ms
low shutter           
return

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

CamOn:  
          
high campwr                     
pause 500            'pause 500 ms
low campwr               
return

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

CamOff:

high campwr
pause 500            'pause 500 ms
low campwr
return

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

CdsChk:

High cds_power                 'Turn on pin to supply voltage to cds voltage divider
readadc C.2, CDS_Value             'Read light value
Low cds_power                 'Turn off voltage divider

If CDS_Value <= CDS_Day_Night Then
Night_Flag = 1                'Night   
endif

If CDS_Value > CDS_Day_Night Then
Night_Flag = 0                'Day
endif

Return
Quote 0 0