Skip to content
Advertisement

How can I count the rising edge of a square signals using python?

I have a square signal using the following code. How can I count the rising edges using python?

JavaScript

Following image represents my output:

output

Advertisement

Answer

If your data is super clean (like the signal provided), then just find the number of occurrences when the value is greater than the previous:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement