Show Encoder Readings on a 7-Segment Display

A simple digital input, such as that from a pushbutton, is either low or high. A digital input, such as that from a digital encoder, is a series of low and high signals that results in a pulse input. The speed and position of the shaft can then be computed by counting the number of pulses.

show complete Wolfram Language input

In this example, an encoder is connected to an Arduino Yún. The number of encoder pulses is determined by counting their rising edges. This value is then displayed on a 7-segment display though a digital decoder. A pushbutton is used to reset the counts to zero.

The encoder has 10 slots. At the tenth revolution or if the button is pressed, the total count tcount is reset. Otherwise, tcount is incremented by the encoder count ecount. Following is the systems model that computes tcount and returns the number of completed revolutions.

Following is the systems model that takes the number of revolutions and computes the Binary Coded Decimal (BCD) value to be sent to the decoder.

The complete systems model.

The encoder and button inputs.

The pins on which the outputs are sent to the decoder.

The complete microcontroller specification.

Deploy the code.

Related Examples

de es fr ja ko pt-br zh