Continuing on my previous question, as a beginner I'm working on learning how to control my 6V motor with magnetic rotary encoder with Arduino Uno Rev3 and the Shield.
When reading tutorials on encoder readings very often I see that pins D2 and D3 have been identified as interrupt pins. I somehow managed to set pins D6 and D7 in Arduino Create as my encoder A and B outputs (although it's still a work in progress and I'm trying to translate the readings into something useful). However, I'm working on a code in Matlab as well (following this tutorial) and Matlab flat out refuses to allow me to set any pins as encoder channelA and channelB other than D2 and D3, respectively.
The issue is obviously that I don't know how to both control PWM A and get encoder readings at the same time from pin D3. Can someone point me to the relevant literature where I can understand this better. Why are both hard coded to pin 3? With so many other pins didn't the board designer anticipate conflicts such as this? And does this mean that I have to choose one or the other - as in I assume that pin 3 can be set as either OUTPUT or INPUT, but not both at the same time.
Many thanks in advance, I'm eager to learn but very confused by all this.
My motor and encoder are:
1000:1 Micro Metal Gearmotor LP 6V
Magnetic Encoder Pair Kit for Micro Metal Gearmotors, 12 CPR, 2.7-18V (HPCB compatible)