2021-06-27

How to get time between intervals of an on/off sequence?

I'm a bit of an amateur coder, so I'll explain my issue to the best of my ability:

I'm trying to create a Morse Code Light Decoder, with the input being a video of a flashing morse code sequence, and the output being the decoded phrase.

So far, I have gotten a variable that is true when the light is on, and false when it is off. Here is a video of what I have so far:
Demo Video
And here is my program if you want to edit it:
Morse Decoder

What I'm looking for is to somehow convert the fluctuating variable in the top left to something that looks like this:

[{"state":"on", "lengthtime":"300ms"}, {"state":"off", "lengthtime":"200ms"}, {"state":"on", "lengthtime":"400ms"}, ...]

This list is each pulse/pause in order, along with the length of each pulse/pause. This would be easy to parse through and convert to morse. Thank you to anyone who can help!



from Recent Questions - Stack Overflow https://ift.tt/3x2Vqp1
https://ift.tt/eA8V8J

No comments:

Post a Comment