Welcome Anonymous
Fledgling
Fledgling
It is currently Thu Sep 19, 2019 10:04 pm

All times are



Post new topic Reply to topic  [ Array ] 
Author Message
PostPosted: Tue Jun 15, 2010 2:42 pm 
Offline
Galapagos
Galapagos

Joined: Sun Jan 31, 2010 9:02 pm
Posts: 114
'BEGIN USER INPUT
'****************************
symbol MovieLength=60 'in seconds
symbol NightValue=95 'determined by experiment
symbol DayValue=105 'determined by experiment
symbol RefreshTime=63726 'about 2.3 hours
symbol RefreshCounter=28 'multipy by RefreshTime
symbol CamTurnOnTime=1300 'in milliseconds
symbol RefreshOnTime=4 '2.3 times this number seconds
symbol MovieRecordTime=3 '2.3 times this number seconds (recording time for cam)
symbol TurnOffCamTime=45 'if camera is on and no motion turn off after this many seconds
symbol WalkAwayTime=13 '2.3 times this number in seconds
'****************************
'END USER INPUT
symbol ShutterPin=0
symbol CameraPowerPin=1
symbol DayNightSensor=2
symbol DayNightSensorPin=pin2
symbol MotionSensorInput=3
symbol MotionSensorInputPin=pin3
symbol CameraIsONorOFF=bit0
symbol DayLight=bit1
symbol MeasuredLightValue=b3
symbol RefreshTime2=W3
symbol TurnOff=W4
symbol RefreshCounter2=W5
symbol CamIsOff=0
symbol CamIsOn=1


TurnOff=TurnOffCamTime * 225
TurnOff=RefreshTime - TurnOff
RefreshTime2=RefreshTime
RefreshCounter2=RefreshCounter
disablebod
low ShutterPin
low CameraPowerPin
input DayNightSensor
input MotionSensorInput
CameraIsONorOFF = CamIsOff
DayLight = 1

gosub refresh



sleep WalkAwayTime

Do
readadc DayNightSensor,MeasuredLightValue
if MeasuredLightValue < NightValue then
DayLight = 0
end if
if MeasuredLightValue > DayValue then
DayLight = 1
end if

if MotionSensorInputPin = 0 and DayLight = 1 then
if CameraIsONorOFF = CamIsOff then
gosub powerpress
pause CamTurnOnTime
else
'pause 400
end if
if MotionSensorInputPin = 0 then
gosub shutterpress
gosub chk4motion
gosub shutterpress
sleep MovieRecordTime
end if
end if
dec RefreshTime2
if RefreshTime2 = 0 then
RefreshTime2=RefreshTime
dec RefreshCounter2
if RefreshCounter2 = 0 then
RefreshCounter2=RefreshCounter
gosub refresh
end if
end if
if RefreshTime2 < TurnOff and CameraIsONorOFF = CamIsOn then gosub powerpress
Loop


refresh:
if CameraIsONorOFF = CamIsOff then gosub powerpress
sleep RefreshOnTime
if CameraIsONorOFF = CamIsOn then gosub powerpress
return

powerpress:
RefreshTime2=RefreshTime
RefreshCounter2=RefreshCounter
high CameraPowerPin
pause 400
low CameraPowerPin
if CameraIsONorOFF = CamIsOff then
CameraIsONorOFF = CamIsOn
else
CameraIsONorOFF = CamIsOff
end if
return

shutterpress:
RefreshTime2=RefreshTime
RefreshCounter2=RefreshCounter
high ShutterPin
pause 500
low ShutterPin
return

chk4motion:
b1=0
b2=0
Do until b1 > 15 or b2 > MovieLength
if MotionSensorInputPin = 0 then
b1 = 0
end if
inc b2
inc b1
pause 1000
Loop
return


Array

Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 15, 2010 2:46 pm 
Offline
Galapagos
Galapagos

Joined: Sun Jan 31, 2010 9:02 pm
Posts: 114
Ok How about we break it down. What does this code do? Here is a hint: the camera is in movie mode.
Please ignore the periods at the beginning of the lines. It's the only way I can get the code to look very readable.

chk4dun: 'routine name Check for Done
... b1=0 'initialize b1 counter to 0
... b2=0 'initialize b0 counter to 0
... Do until b1 > 15 or b2 > 60 'Do Loop when counter b1 reaches 16 or counter b2 reaches 61 then exit
...... if MotionSensorInputPin = 0 then 'if motion sensor detects motion then do
......... b1 = 0 'reinitialize b1 counter because motion seen
...... end if ' end the if statement
...... inc b2 'increment b2 counter...basically add 1 to b2 counter
...... inc b1 'increment b1 counter...basically add 1 to b1 counter
...... pause 1000 'wait 1000 milliseconds which is 1 second
... Loop 'end the DO LOOP - either b1 counter = 16 or b2 counter = 61
return 'end routine


Array

Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 17, 2010 12:32 pm 
Offline
King
King
User avatar

Joined: Tue Feb 16, 2010 3:20 pm
Posts: 482
Would this be an ss board and record lenths of 15 seconds or 60 seconds depending on the trail/feeder switch?


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 17, 2010 12:50 pm 
Offline
Galapagos
Galapagos

Joined: Sun Jan 31, 2010 9:02 pm
Posts: 114
Very close. Yes it is a SSS board. I use this code with the camera in video mode. It will be in this routine for 15 seconds up to 60 seconds. If anytime between that, it has been 15 seconds of no motion it will exit the routine. I use this to decide the length of my videos. If motion is constantly there the video will be 60 seconds, if motion disappears quickly the video will only be 15 seconds long. This saves battery and memory but still makes longer videos possible. I will edit and add comments.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 17, 2010 1:06 pm 
Offline
Galapagos
Galapagos

Joined: Sun Jan 31, 2010 9:02 pm
Posts: 114
Do we want to do more of this? Who wants to learn to program the SSS board?


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 24, 2010 10:45 am 
Offline
Emperor
Emperor
User avatar

Joined: Fri Jan 29, 2010 1:04 pm
Posts: 7487
Location: Northern Minnesota
Hey Greg, how is this working for you? Is it copy and paste ready?

_________________
Homebrew Reference Site
My Calendar Store
My Land


"Wilderness to the people of America is a spiritual necessity, an antidote to the high pressure of modern life, a means of regaining serenity and equilibrium."
- Sigurd Olson


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ Array ] 

All times are


Who is online


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group