9.4 Arduino Rotary Encoder Functions

9.4.1 @rotaryEncoder/delete

: delete (dev)

Free resources of a encoder object.

Inputs

dev - object to free

See also: rotartEncoder.

9.4.2 @rotaryEncoder/display

: retval = display (obj)

Display the rotary encoder object in a verbose way,

Inputs

obj - the arduino rotary encoder object created with rotaryEncoder

See also: rotaryEncoder.

9.4.3 @rotaryEncoder/readCount

: [count, time] = readCount (obj)
: [count, time] = readCount (obj, name, value)

read count value from the rotary encoder.

subsubheading Inputs obj - rotary encoder object created with rotaryEncoder call.

name, value - optional name,value pairs

Valid option name pairs currently are:

reset

Reset the count after reading (if true)

Outputs

count - returned count read from the encoder.

time - seconds since arduino started

See also: rotaryEncoder, resetCount.

9.4.4 @rotaryEncoder/readSpeed

: speed = readSpeed (obj)

read rotational speed from the rotary encoder.

Inputs

obj - rotary encoder object created with rotaryEncoder call.

Outputs

speed - returned speed in revolutions per minute read from the encoder.

See also: rotaryEncoder, resetCount.

9.4.5 @rotaryEncoder/resetCount

: reset (obj)
: reset (obj, cnt)

reset the rotary encoder count values

Inputs

obj - the rotaryEncoder object

cnt - optional count value to reset to

See also: rotaryEncoder, readCount.

9.4.6 @rotaryEncoder/rotaryEncoder

: obj = rotaryEncoder (ar, chanApin, chanBpin)
: obj = rotaryEncoder (ar, chanApin, chanBpin, ppr)

Create a rotaryEncoder object controlled by the input pins.

Inputs

ar - connected arduino object.

chanApin - pin used for channel A

chanBpin - pin used for channel B

ppr - count of encoder pulsed required for a full revolution of the encoder.

Outputs

obj - created rotary encoder object

Example

 a = arduino ();
 enc = rotaryEncoder(a, "d2", "d3", 180);
 

Properties

The rotaryEncoder object has the following public properties:

parent

The parent (arduino) for this device

pins

pins used by this object

ppr

Number of pulses used per rotation

See also: arduino.

9.4.7 @rotaryEncoder/subsref

: val = subsref (dev, sub)

subref for rotaryEncoder

See also: rotaryEncoder.


Next: Arduino Servo Functions, Previous: Arduino I2C Functions, Up: Function Reference   [Contents][Index]