• Products
    • Isadora
    • Get It
    • ADD-ONS
    • IzzyCast
    • Get It
  • Forum
  • Help
  • Werkstatt
  • Newsletter
  • Impressum
  • Dsgvo
  • Press
  • Isadora
  • Get It
  • ADD-ONS
  • IzzyCast
  • Get It
  • Press
  • Dsgvo
  • Impressum

Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags

    Urgent help with Arduino!

    Interfacing
    4
    8
    3380
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • vanakaru
      vanakaru last edited by

      Suddenly my Arduino based instroment does not work. I have been troubleshooting this for days, but running out of time. So my last option would be to transfer everything into Isadora and Arduino.

      I have several (7) photocells or pololu QTR-1A's wired to Arduino and I want to get the analogread values into Isadora for further manipulation.
      I test with Mark's Isadora-Arduino example found here 
      http://forum.troikatronix.com/cgi-bin/forum/gforum.cgi?post=5368
      All works well(and I have used this few times before) until I change anything in Serial In Watcher edit window. Like adding next value - value3 is added and all communication stops. If I delete this all starts working again.
      I have this in edit window:

      value1 : integer = 3 digits

      ','

      value2 : integer = 3 digits

      If I add:

      ','

      value3 : integer = 3 digits

      all stops.

      I have moddified Arduino sctch like this

      void setup() {

        Serial.begin(9600); 

      }

      void loop() {

        // read the analog input into a variable:

        int analogValue = analogRead(0);

        Serial.print(analogValue, DEC);

        const int comma = ',';

        Serial.print(comma, BYTE);

        analogValue = analogRead(1);

        Serial.println(analogValue, DEC);

        Serial.print(comma, BYTE);     //this should get me next value from pin2

        analogValue = analogRead(2);

        Serial.println(analogValue, DEC);

      }

      MBP 4.1 & MBP (Retina, Mid 2012) MBP Retina 2017

      1 Reply Last reply Reply Quote 0
      • vanakaru
        vanakaru last edited by

        My brain is pretty much dead by now. Obviously I am doing something  wrong.
        I would like to use this code with Arduino. So I have no idea how to edit serial in watcher commands in Isadora.
        [code]#include
        #define NUM_SENSORS             7  // number of sensors used
        #define NUM_SAMPLES_PER_SENSOR  4  // average 4 analog samples per sensor reading
        #define EMITTER_PIN             2  // emitter is controlled by digital pin 2
        // sensors 0 through 5 are connected to analog inputs 0 through 5, respectively
        QTRSensorsAnalog qtra((unsigned char[]) {0, 1, 2, 3, 4, 5, 6}, 
          NUM_SENSORS, NUM_SAMPLES_PER_SENSOR, EMITTER_PIN);
        unsigned int sensorValues[NUM_SENSORS];
        void setup()
        {
          delay(500);
          pinMode(13, OUTPUT);
          digitalWrite(13, HIGH);    // turn on Arduino's LED to indicate we are in calibration mode
          for (int i = 0; i < 400; i++)  // make the calibration take about 10 seconds
          {
            qtra.calibrate();       // reads all sensors 10 times at 2.5 ms per six sensors (i.e. ~25 ms per call)
          }
          digitalWrite(13, LOW);     // turn off Arduino's LED to indicate we are through with calibration
          // print the calibration minimum values measured when emitters were on
          Serial.begin(9600);
          for (int i = 0; i < NUM_SENSORS; i++)
          {
            Serial.print(qtra.calibratedMinimumOn[i]);
            Serial.print(' ');
          }
          Serial.println();
          // print the calibration maximum values measured when emitters were on
          for (int i = 0; i < NUM_SENSORS; i++)
          {
            Serial.print(qtra.calibratedMaximumOn[i]);
            Serial.print(' ');
          }
          Serial.println();
          Serial.println();
          delay(1000);
        }
        void loop()
        {
          // read calibrated sensor values and obtain a measure of the line position from 0 to 5000
          // To get raw sensor values, call:
          //  qtra.read(sensorValues); instead of unsigned int position = qtra.readLine(sensorValues);
          unsigned int position = qtra.readLine(sensorValues);
          // print the sensor values as numbers from 0 to 1000, where 0 means maximum reflectance and
          // 1000 means minimum reflectance, followed by the line position
          for (unsigned char i = 0; i < NUM_SENSORS; i++)
          {
            Serial.print(sensorValues[i]);
            Serial.print('\t');
          }
        }[/code]

        8b7b82-is.jpg

        MBP 4.1 & MBP (Retina, Mid 2012) MBP Retina 2017

        1 Reply Last reply Reply Quote 0
        • DusX
          DusX Tech Staff last edited by

          Wish I could help, but I am far from my gear at the moment, so I can't just open one of my working patches.
          Do you see anything in the Serial watcher in Isadora?

          Troikatronix Technical Support

          • New Support Ticket Link: https://support.troikatronix.com/support/tickets/new
          • My Add-ons: https://troikatronix.com/add-ons/?u=dusx
          • Profession Services: https://support.troikatronix.com/support/solutions/articles/13000109444-professional-services

          Running: Win 11 64bit, i7, M.2 PCIe SSD's, 32gb DDR4, nVidia GTX 4070 | located in Ontario Canada.

          1 Reply Last reply Reply Quote 0
          • m_theater
            m_theater last edited by

            on the isadora side

            i would split the task in two steps
            "serial in watcher text" using this code "all_out:string=eol"
            (this gives you a text sting with all values or messages included)
            and a "text parser" with this one
            val1: int = #

            ","

            val2: int = #

            ","

            val3: int = #

            ---
            i am just guessing for the arduino:
            void loop()
            {
              // read calibrated sensor values and obtain a measure of the line position from 0 to 5000
              // To get raw sensor values, call:
              //  qtra.read(sensorValues); instead of unsigned int position = qtra.readLine(sensorValues);
              unsigned int position = qtra.readLine(sensorValues);
              // print the sensor values as numbers from 0 to 1000, where 0 means maximum reflectance and
              // 1000 means minimum reflectance, followed by the line position
              for (unsigned char i = 0; i < NUM_SENSORS; i++)
              {
                Serial.print(sensorValues[i]);
                Serial.print(",");
              }
              Serial.println();
            }[/code]
            ---
            hope this helps
            clemens

            13404f-screen-shot-2014-06-09-at-11.41.31.png

            avk4.net

            1 Reply Last reply Reply Quote 0
            • fubbi
              fubbi last edited by

              did you get it going?

              Mac M2 Ultra, 64gb — Berlin

              1 Reply Last reply Reply Quote 0
              • m_theater
                m_theater last edited by

                just checking your first arduino code

                  // read the analog input into a variable:

                  int analogValue = analogRead(0);

                  Serial.print(analogValue, DEC);

                  const int comma = ',';

                  Serial.print(comma, BYTE);

                  analogValue = analogRead(1);

                  Serial.println(analogValue, DEC);

                  Serial.print(analogValue, DEC); (you have to delete the ln behind print)

                  Serial.print(comma, BYTE);     //this should get me next value from pin2

                  analogValue = analogRead(2);

                  Serial.println(analogValue, DEC);

                because of the println the last message being processed is the

                "," value2 "linefeed"

                this doesn't match with your parsing pattern, and you will not see a processing in the serial in watcher …

                avk4.net

                1 Reply Last reply Reply Quote 0
                • vanakaru
                  vanakaru last edited by

                  @m_theater

                  You last comment did the trick.
                  Finally I got it working. However I have no idea why your first advise locked the sensors to 0(saturated). Otherwise I got the feed as supposed(just bunch of 0's in my case). I shall investigate after tomorrows show opening. 
                  Thank you!
                  So the last serial print should be Serial.println. And you need to get rid of the number (3) before the digits in serial parser text
                  ARDUINO CODE
                  void setup() {
                    Serial.begin(9600); 
                  }
                  void loop() {
                  );
                    // read the analog input into a variable:
                    //-1-////////////////////////////////
                    int analogValue = analogRead(0);
                    Serial.print(analogValue, DEC);
                    const int comma = ',';
                    Serial.print(comma, BYTE);
                    //-2-///////////////////////////////
                    analogValue = analogRead(1);
                    Serial.print(analogValue, DEC);
                    Serial.print(comma, BYTE);
                    //-3-////////////////////////////////
                    analogValue = analogRead(2);
                    Serial.print(analogValue, DEC);
                    Serial.print(comma, BYTE);
                    //-4-////////////////////////////////
                    analogValue = analogRead(3);
                    Serial.print(analogValue, DEC);
                    Serial.print(comma, BYTE);
                    //-5-////////////////////////////////
                    analogValue = analogRead(4);
                    Serial.print(analogValue, DEC);
                    Serial.print(comma, BYTE);
                    //-6-////////////////////////////////
                    analogValue = analogRead(5);
                    Serial.print(analogValue, DEC);
                    Serial.print(comma, BYTE);
                    //-7-////////////////////////////////
                    analogValue = analogRead(6);
                    Serial.println(analogValue, DEC);//println the last message being processed is the
                    //"," value6 "linefeed"
                    // wait 10 milliseconds for the analog-to-digital converter
                    // to settle after the last reading:
                    delay(10);
                  }
                  SERIAL INPUT PARSER

                  value1 : integer = digits

                  ','

                  value2 : integer = digits

                  ','

                  value3 : integer = digits

                  ','

                  value4 : integer = digits

                  ','

                  value5: integer = digits

                  ','

                  value6 : integer = digits

                  ','

                  value7 : integer = digits

                  MBP 4.1 & MBP (Retina, Mid 2012) MBP Retina 2017

                  1 Reply Last reply Reply Quote 0
                  • m_theater
                    m_theater last edited by

                    great that it worked out in the end, and sorry that i was a bit lazy not to mark up the println at the end

                    concerning the first arduino attempt it could be in the qtr code you are accessing
                    anyway have a good opening
                    greetings from berlin
                    clemens

                    avk4.net

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post