Main Content

resetCount

Set encoder count value to zero or specified value

Description

example

resetCount(encoder) resets the count value of the rotary encoder to zero.

example

resetCount(encoder,count) resets the count value of the rotary encoder to a specified value.

Examples

collapse all

Create a connection to the Nano Motor Carrier.

arduinoObj = arduino('/dev/ttyACM0','Nano33IoT','Libraries','MotorCarrier');
mcObj = motorCarrier(arduinoObj);

Create a connection to the rotary encoder.

encoder = rotaryEncoder(mcObj,1);

Reset encoder count value to 0.

resetCount(encoder);

Create a connection to the Nano Motor Carrier.

arduinoObj = arduino('/dev/ttyACM0','Nano33IoT','Libraries','MotorCarrier');
mcObj = motorCarrier(arduinoObj);

Create a connection to the rotary encoder.

encoder = rotaryEncoder(mcObj,1);

Reset encoder count value to 10.

resetCount(encoder,10);

Input Arguments

collapse all

Connection to the rotary encoder on MKR Motor Carrier or Nano Motor Carrier, specified as an object.

Encoder count value to set, specified as a number.

Introduced in R2020a