Hi

I am rather rusty on BASIC programming, having been absent from it for 40+ years. I have a remotely controlled GoPro, using third party remote control from YOCTOP This remote has been hacked and a PIC12F683 inserted. The pic "presses" the record button to start a recording and has to press it again to stop. The cycle I want is 3 seconds of recording time every minute.

Mainloop:
if CYCLE = 0 then goto Mainloop ' do not do any recording
if cycle = 1 then gosub recording ' do the record cycle

Recording:
low RECPB ' Low Rec PB to start recording
Pause 500 ' start recording for 3 seconds
high RECPB ' High Rec PB after recording start
for j = 1 to 3000 ' Loop count for rec timing
pause 1
next j
low RECPB ' Low Rec PB to stop recording
Pause 500 ' Stop recording after 3 seconds
high RECPB ' High Rec PB after recording Stop
for k = 1 to 57000 ' Pause for 57 seconds and repeat cycle.
pause 1 '
next k
return

goto mainloop

end


This works fine until I press the record button manually and then the system records for 57 seconds and skips 3 . . . .

I need to detect if the cycle has been "inverted" and flash a red LED at me to manually press record again.

The Yoctop remote has a green LED that gives feedback as follows: Steady ON means not recording. Blinking 0.5s off / 0.5s on means recording.

What I thought of doing was to sample the on/off status of that LED over a moving window of 1.0 seconds. If on and off periods are similar (within 5%), it is recording. If on exceeds off (by more than 10%) it is not recording. Finally the pic must check if it is recording in the 57 sec when it is not supposed to record and then blink a red led at me. But I am stumped on how to do that elegantly in BASIC. Any and all help would be very much appreciated, thank you in advance.

(A friend has built similar for me before and I used it to make these non-monetized YouTubes)