PWM help

Hello!

I'm begginer with arduino and programming in general. For my project I need to set up a program witch reads incoming PWM signal and when the PWM signal is at 100% ,it makes 2 pins to go HIGH. I'm capable of making the 2 pins go HIGH :smiley: The problem is I cant figure out how to make Atmega328P to understand that incoming signal is in 100% duty cycle. Any ideas how? Or is it even possible? Thanks!

The 100% signal will have no edges in it, anything less will have edges.

Does that help make things clearer? / simpler?

CtrlAltElite:
The 100% signal will have no edges in it, anything less will have edges.

0% PWM also has no edges.

(but it is easy to tell whether it is 0% or 100%).

CtrlAltElite:
The 100% signal will have no edges in it, anything less will have edges.

Does that help make things clearer? / simpler?

I know about how PWM works :smiley: problem is I dont know in what code functions Arduino and Atmega328 could understand that.

problem is I dont know in what code functions Arduino and Atmega328 could understand that.

Juozys:
I know about how PWM works :smiley: problem is I dont know in what code functions Arduino and Atmega328 could understand that.

Each pass of loop, if you see an edge then record the value from micros in a variable. Every pass of loop compare the current time to the time you recorded to see how long it has been since you've seen your last edge. If it has been long enough as defined by the frequency of the pwm then you can decide that it must be 100% duty.