Contents
Basic example for encoders
create arduino object and connect to board
if exist('a','var') && isa(a,'arduino') && isvalid(a),
else
a=arduino('DEMO');
end
Demo mode connection .......
Motor Shield V1 sketch detected !
Arduino successfully connected !
encoders
encoderAttach(a,0,3,2)
encoderRead(a,0)
encoderAttach(a,2,18,21)
encoderDebounce(a,2,17)
encoderRead(a,2)
encoderDebounce(a,0,20)
encoderRead(a,0)
encoderReset(a,0)
encoderStatus(a);
encoderDetach(a,0);
encoderDetach(a,2);
ans =
17705
ans =
-11634
ans =
18661
Encoder 0 is ATTACHED
Encoder 1 is DETACHED
Encoder 2 is ATTACHED
close session
delete(a)