Arduino connection with Isadora



  • Hi,

    Probably there are some answers for this question but I really couldn't find any during those days.
    I have a rotary encoder which is controlled by Arduino, rotary encoder uses digital pins(2 and 3) and I need to get those values in Isadora.
    I tried this example : [http://art-research2010summer.blogspot.co.uk/2010/06/tutorial-01-isadora-and-arduino.html](http://art-research2010summer.blogspot.co.uk/2010/06/tutorial-01-isadora-and-arduino.html)  and it worked fine but there was a connection with analog pin and I think this may be the problem. 
    Any help or resource for Arduino and Isadora connection would be very helpful and if I need to provide more details please let me know.
    Best,
    Ilir


  • First though are we talking about the same thing- you said the rotary encoder is controlled by arduino- if it is a rotary encoder then it will be the other way round. Ill assume that was a typo.

    You should have no problem using a rotary encoder and Isadora. Essentially the arduino is a serial device. In your arduino code you just need to use Serial.write(rotary_encoder_values).

    To know if the encoder is working I assume you have done that much already? Rotary encoders are a bit of a pain to get right with arduino and need some checking (I assume again if it is working you are using pin interrupts on rising and falling to get accurate readings in both directions?) If not how did you debug your Arduino code?
    Can you link to your arduino code somewhere and I can help out? 
    Once you are printing serial you just have to get isadora to read the serial input and do whatever you like with it. Remember to set your your baudrate the same in your arduino sketch as you do in your Isadora setup.


  • Hi @Fred,

    Yes my Arduino code is working fine I can see the values in the serial monitor in Arduino I am trying with these values to change the rotation of the 3d objects(3d player) in Isadora. 
    In attachment you can find the code of Arduino(is not final code but it works) and library that I am using.

    f0f491-rotary.zip 715578-encoder.zip



  • Ok, there are a few things to fix in the arduino code. The things to change are now red

    Encoder knobLeft(2, 3);
    long positionLeft  = -999;
    long newLeft;
    These can go before the setup, you had one in the loop that was being created every time.
    void setup() {
      Serial.begin(115200); You can increase the speed of this to 115200, you will need to change your serial monitor as well if you use arduino to check it is all working.
      //Serial.println("TwoKnobs Encoder Test:");  You can get rid of this line, you only need to send the values as decimals out the serial port to isadora, this is cute but not needed for your patch
    }
    void loop() {
      newLeft = knobLeft.read();
      if (newLeft != positionLeft ) {
          if(newLeft>=360){
          knobLeft.write(0);
        }
        Serial.print(1,DEC); Just print not prinln
       // Serial.print("Left = "); You don't need this either
        Serial.println(newLeft,DEC); Add the DEC here and use println
        //Serial.println(); You don't need this either
        positionLeft = newLeft;
      }
      // if a character is sent from the serial monitor,
      // reset both back to zero.
      if (Serial.available()) {
        Serial.read();
        Serial.println("Reset both knobs to zero");
        knobLeft.write(0);
      }
    }
    Now go to Isadora and and hit communications and serial port setup, change the speed of the first port to 115200 and choose your arduino from the device list.
    Next use a serial in watcher text actor, double click on it and a black page will appear, paste this into the page
    "1"
    
    value : integer = 4 digits
    

    And you will see an output appear, that output should give you the serial reading from your arduino as a number you can use to do anything with.

    I dont have any arduino stuff with me at the moment but I think that will get you going.
    Fred



  • Firstly thank you @Fred, but again I am not getting any output in Isadora again.

    I have enabled serial port and change eom char but is the same. Sorry for bothering you but I really have no idea what is going wrong.
    Best,
    Ilir


  • It is fixed now even though I do not know what exactly I have done some of the chafes that I have done from you're last advice: Serial.begin(9600); Integer = digits (without 4) and eom charr 10. Thank you again Fred


Log in to reply
 

Looks like your connection to TroikaTronix Community Forum was lost, please wait while we try to reconnect.