Flanks of ascent and descent with Arduino

What are the flanks of ascent or descent?

Rise flank consists of change of a signal level low to a high level, conversely the flank of descent is the change from a high level to one low, it's really important to know these concepts if programmed automatons or electronics, including the famous Arduino.

 

 

Flanks of ascent and descent
Flanks of ascent and descent

When to use the flanks?

 

On occasions when we schedule an electronic device (or an automaton) we are interested in a response in contrast and not continuous. Complicated, right? well imagine that we have a program for a football where a marker is indicating the outcome of the game, is simple, only detects the ball as it passes through the goal. If programmed you that we want to add one to the result to detect the ball, our program is going to add one each time that reaches a high signal, if at the time the ball is detected 20 cycles of program, we suddenly have 20 goals.

Here have a case of flank of rise, US interests that only detects the rise and us add a point and not add more independently of them cycles of program that perform. By the contrary the flank of down will be the reverse, imagine that in an installation want know if a detector of fire has been reassembly, i.e., that has given a signal high and later a low, as will use the flank of lowered.

 

Schedule a rise flank

To program a flank of ascent, take into account the State of the entry in the previous cycle of the programme and the current cycle, if the input is different from the output, we have a detected flank. In this case, the previous input should be LOW (0) and the current input HIGH (1), if such event take action. We update cycle input to the present to carry out the process in the following.

Senalactual = sensor measurement;
If (Senalactual == HIGH & Senalantigua == LOW)
{
   RUN ACTION
}
Senalantigua = Senalactual

 

Set down flank

The flank of lowered will be similar to the of ascent but changing the sentence if them HIGH by LOW.

Senalactual = sensor measurement;
If (Senalactual == LOW & Senalantigua == HIGH)
{
   RUN ACTION
}
Senalantigua = Senalactual

 

Programming a detector of flanks

It is also possible to perform a flank detector regardless of whether is ascent or descent, to run for example an alarm whenever there is a change.

Senalactual = sensor measurement;
If (Senalactual! = Senalantigua)
{
   RUN ACTION
}
Senalantigua = Senalactual

 

Links:

Example of a detector of flanks with arduino.

Arduino Freelance programmer

Exhibitor Arduino

If you wish to buy an Arduino for this or other projects click here or on the image.

Arduino genuine one
Genuine Arduino

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.