[SOLVED: INCORRECT BAUD RATE] Problems with Arduino in Isadora


  • Hi,

    Just tried to attach my Arduino to Isadoro with 'enable serial port' then the message below showed up.

    When I opened the Arduino in another Isadora file I did not receive this message, but the signals send through my Arduino were not visible in Isadora. 

    Does anyone know how to solve this and get my Arduino connected to Isadora?


  • @erin

    Three things that would allow us to help you.

    1) Post your Arduino sketch
    2) Post your Isadora patch
    3) Choose Windows > Show Monitor and take a screen shot of what is in the Monitor Window

    At least #3 would be important. If you don't want to share these things publicly, open a ticket and send them to us privately and we'll help get you sorted.

    Best Wishes,
    Mark

    P.S. It's spelled Isadora with an 'a', not Isodora with an 'o'


  • @mark Thank you for your reply! Here is the Isadora file  The most right scene is where I made a user actor for the sensors. (when I upload he Arduino code I don't see a link) I made screenshots of the Arduino code. Gertjan Biasino made it for me. And a screenshot of the monitor.


  • @erin you can also copy and paste the code itself, not the arduino file, when you paste it into the forum you can highlight all the code and then under the format button there is a code preset.

    Then the code will appear in the forum post like this.
    

    This makes it easy to read and copy if needed


  • @erin said:

    @mark Thank you for your reply! Here is the Isadora file  The most right scene is where I made a user actor for the sensors. (when I upload he Arduino code I don't see a link) I made screenshots of the Arduino code. Gertjan Biasino made it for me. And a screenshot of the monitor.

     It looks like you're using Firmata on the Arduino. Is that true?

    Best Wishes,
    Mark


  • @mark and @fred

    Hi, I don't know if I am using Firmata. Gertjan wrote it for me and I don't know much about coding.

    Gertjan told me to take out pint nr 1 and 2, so I'll do that and take out everything in the Arduino.

    Here is the code:

    //library installeren: https://github.com/Teknologisk...
    #include <afstandssensor.h> // dit is alles wat je moet aanpassen
    // afstandssensor: de 2 pinnen ingeven eerst de trigger pin dan de echopin.
    AfstandsSensor afstandssensor(12, 10);     // AfstandsSensor(triggerPin, echoPin); // Andere sensoren
    // een lijstje maken met de pinnen waar de sensor aan verbonden is. De volgorde van dit lijstje bepaald ook de volgorde in isadora (ID nummers). De eerste is "1" de 2e "2" enzovoort
    int IN_PINs[] = {3,4,5,6,7}; // hier geef je de snelheid in die je ook in isadora gebruikt
    int SerialSnelheid = 19200;
    //--------------------------------------- //alles wat nu volgt gaat automatisch
    //Dit zijn variabelen om de waardes op te slaan
    float Val[(sizeof(IN_PINs)/sizeof(int))+1]; 
    float prevVal[sizeof(Val)/sizeof(float)]; //Dit is de lijst met nummer om naar isadora te sturen
    int targetIDs[sizeof(Val)/sizeof(float)]; //een ID tag die er voor zorgt dat elke waarde gescheiden kan worden void setup()
    {
      //Setup serial snelheid (deze moet hetzelfde zijn in isadora die staat
      Serial.begin(SerialSnelheid);   
      Serial.flush();   // dit maakt van al je senor pins inputs
      for (int i = 0; i < sizeof(IN_PINs)/sizeof(int); i++){
        pinMode(IN_PINs[i], INPUT);
      }   //dit zet alle waarden op 0 en maakt een lijstje met de ID nummers
      for (int i = 0; i < sizeof(Val)/sizeof(float); i++){
       Val[i]=0;
       prevVal[i]=0;
       targetIDs[i]=i; // elke target krijgt ander nummer
      }
    } void loop()
    { //dit berekend de afstand en zet het op waarde 0
    Val[0]= afstandssensor.afstandCM(); //dit kijkt naar alle waardes van de sensoren en slaat die op in een lijst.
    for(int i = 1; i<sizeof(IN_PINs)/sizeof(int)+1;i++){
      Val[i] = digitalRead(IN_PINs[i-1]);
    } //hier gaan we door de hele lijst om te kijken wat we gaan doosturen
     for (int i = 0; i < sizeof(Val)/sizeof(float); i++){ 
        
        // we sturen enkel door wat veranderd is (is de huidige waarde verschillend van de vorige)
        if (Val[i] != prevVal[i]){
          
          //is het veranderd, dan zeggen we dat de vorige waarde gelijk is aan de huidige waarde
          prevVal[i] = Val[i];       //nu kijken we of er geen foutwaarde wordt gerekend (als de sensor niet weet wat het is, er is niemand of er is een fout dan geeft hij -1)
          // dus enkel als de waarde verschilt van -1 gaan we het naar isadora sturen
          if (Val[i] != -1){ 
            Serial.print(targetIDs[i], DEC);  //zend het ID nummer
            Serial.print(int(Val[i]));        //zend de waarde
            Serial.println();                 //zend een carriage return (einde van bericht) de ASCII waarde van een carriage return ('\n') is 10. dat is ook degene die je moet ingeven in isadora
          }
         
       }
      } }

  • @erin said:

    Hi, I don't know if I am using Firmata. Gertjan wrote it for me and I don't know much about coding.Gertjan told me to take out pint nr 1 and 2, so I'll do that and take out everything in the Arduino.

     I don't know what you mean about "pint nr 1 and 2" -- do you mean print? In any case, there are the linefeed characters that should be generated by the println() statement are not showing up in the Monitor Window. I can't really go much further, because I don't have the hardware that you have. I ran the source code through Google Translate so I could see the comments in English. (It is at the end of this post.)

    The line I am talking about is the one that says:

     Serial.println (); // send a carriage return (end of message) the ASCII value of a carriage return ('\ n')

    Is there some reason that line would not be executing?

    Also the code says:

     // Setup serial speed (it must be the same in isadora that is)

    Have you actually set the Baud rate to 19200 in the Serial Setup dialog? (Choose Communications > Serial Port Setup...)

    // install library: https: //github.com/Teknologisk ...
    #include <remote sensor.h>
    // this is all you need to adjust
    // remote sensor: the 2 pins enter the trigger pin first, then the echo pin.
    DistanceSensor distance sensor (12, 10); // RemoteSensor (triggerPin, echoPin);
    // Other sensors
    // make a list of the pins the sensor is connected to. The order of this list also determines the order in isadora (ID numbers). The first is "1" the second "2" and so on
    int IN_PINs [] = {3,4,5,6,7};
    // here you enter the speed that you also use in isadora
    int SerialSpeed = 19200;
    // ---------------------------------------
    // everything that follows is automatic
    // These are variables to store the values
    float Val [(sizeof (IN_PINs) / sizeof (int)) + 1];
    float prevVal [sizeof (Val) / sizeof (float)];
    // This is the list of number to send to isadora
    int targetIDs [sizeof (Val) / sizeof (float)]; // an ID tag that ensures that each value can be separated
    void setup ()
    {
        // Setup serial speed (it must be the same in isadora that is
        Serial.begin (SerialSpeed);
        Serial.flush ();
        // this turns all your senor pins into inputs
        for (int i = 0; i <sizeof (IN_PINs) / sizeof (int); i ++) {
            pinMode (IN_PINs [i], INPUT);
        }
        // this sets all values to 0 and lists the ID numbers
        for (int i = 0; i <sizeof (Val) / sizeof (float); i ++) {
            Val [i] = 0;
            prevVal [i] = 0;
            targetIDs [i] = i; // each target gets a different number
        }
    }
    void loop ()
    {
        // this calculates the distance and sets it to value 0
        Val [0] = distance sensor.distanceCM ();
        // this looks at all the values from the sensors and stores them in a list.
        for (int i = 1; i <sizeof (IN_PINs) / sizeof (int) +1; i ++) {
            Val [i] = digitalRead (IN_PINs [i-1]);
        }
        // here we go through the entire list to see what we are going to send
        for (int i = 0; i <sizeof (Val) / sizeof (float); i ++) {
            // we only send what has changed (is the current value different from the previous one)
            if (Val [i]! = prevVal [i]) {
                // if it has changed, we say the previous value is equal to the current value
                prevVal [i] = Val [i];
                // now we check if no error value is calculated (if the sensor does not know what it is, there is no one or there is an error then it returns -1)
                // so only if the value is different from -1 we will send it to isadora
                if (Val [i]! = -1) {
                    Serial.print (targetIDs [i], DEC); // send the ID number
                    Serial.print (int (Val [i])); // send the value
                    Serial.println (); // send a carriage return (end of message) the ASCII value of a carriage return ('\ n') is 10.this is also the one you have to enter in isadora
                }
            }
        }
    }
    
  • Beta Platinum

    I also think it is the Baud rate and maybe that is why some lines don't come through.

    The pins 0 and 1 sometimes give false readings because the are also used as Rx and tx for serial communication. So it is best not to use them for sensors. Just to be sure.


    With kind regards
    Gertjan


  • @gertjanb and @mark Yes, I see now it is indeed the Baud rate! Thank you very much, it is working now!