Hello, i want to use encoder with baby-o. For calculate, distance with encoder. Here is my example code and its working pretty good. But when i try to use PD1 i could not count the encoder pulses. Am i missing something with PD1 ? I saw on pin mapping that pin also can use for user red led. But it is also Digital IO.
Note 1 : for the future, i will control pozition with my baby o, so i will use 2 motor and for each motor 2 encoder channel.
I am planning to use for encoder channels, PD0 - PD1 - PB5 - PB4 . These are my only free pins on baby o. I also planning to use for buzzer PB2 and and my own led PB1. So if you suggest me to change for led to PD1 or buzzer pin with PD1, i will be waiting.
Note2 : My encoder resulation is 14 pulses per 1 rotation. And my motor is 12.000 RPM. So i will use it on high speeds too.
// a and x are global variable
if (((PIND & 0x01) != 0) && (a==0))
if (((PIND & 0x01) == 0) && (a==1))
if ((x>=0) && (x<=100))
wait(10); //wait is my function for delay 10 second.