Activity Forums Questions & Troubleshooting Encoder on MINI Reply To: Encoder on MINI

  • LeoOfVenice

    Member
    May 2, 2021 at 4:12 pm

    Hello
    I’m going to make the same connection with the same Rotary Encoder.

    I have already done a test with arduino UNO board where channel A connected is to pin 2 and channel B connected to pin 3, to use interrupts, everything works fine here is the setup for connection on UNO BOARD.

    …..

    void setup() {
    pinMode(2, INPUT_PULLUP); // internal pullup input pin 2
    pinMode(3, INPUT_PULLUP); // internal pullup input pin 3
    //Setting up interrupt
    //A rising pulse from encodenren activated ai0(). AttachInterrupt 0 is DigitalPin nr 2 on moust Arduino.
    attachInterrupt(0, ai0, RISING);
    //B rising pulse from encodenren activated ai1(). AttachInterrupt 1 is DigitalPin nr 3 on moust Arduino.
    attachInterrupt(1, ai1, RISING);
    }

    …..

    Now, with CONTROLLINO I want to make same function and I’m happy to read your post with your suggestions but I am little confused (is possible to have a picture of the connections?):

    i am looking at your schetch:

    unsigned long A = 3; // ( is this interrupt pin ? )
    unsigned long B = 2;


    pinMode (A, INPUT); // not INPUT_PULLUP since we are attaching external Pullup reistors
    pinMode (B, INPUT); // not INPUT_PULLUP since we are attaching external Pullup reistors
    St.

    Are you using pin header or screw terminal?

    I suppose screw terminal, beacuse you connect PULL-UP resistors to 12V ,but If you are using screw terminals, why don’t you initialize them as A3 or A2 in the schetch, and you define input as 3 an 2 as PIN HEADER?

    <div>

    And instead..

    If you are using pin headers why do you use the PULL-UP resistor connected with 12 V and not with 5V ?

    (It would be interesting to be able to insert images in these posts.)

    Thank in advance for your help

    </div>