Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

  • Art-Net Library for Processing

    They have been recommended to me in the past, but they only work with wifi! I'd rather use ethernet cables and network switches, because that's more reliable than wifi in a stage setting. The ideal microcontroller can do both as wifi is a lot easier to set up than running cables, but the question remains how well they will work when there are a lot of them (currently at eight strips/controllers but I want MO4R!). Ideally I'd need something like an Arduino Mega but that gets expensive, and is probably overkill anyway.

  • Art-Net Library for Processing

    @cansik I made this overly complicated setup... I have a number of RGBW LED strips that I control with Arduinos, which are controlled by Raspberry Pis. The Pis run a Processing sketch that I can send commands to from another sketch running on my laptop. I could select colour, effect and effect speed per LED strip. No individual pixel control from the laptop even though the leds are individually addressable, but I programmed some effects on the Arduinos that used this property.

    For a gig, my friend was using a Chamsys board running MagicQ. So I reprogrammed the sketch running on my laptop to accept art-net using your fine library. We connected the Chamsys board to my laptop with an Ethernet cable through one of its art-net outputs and voila, the LED strips became controllable from his console! Works also with Freestyler.

    Only downside was a slight delay between control input and LED strip response, which isn't surprising if you know the signal path: console -> (art-net) -> laptop running Processing -> (wifi) -> Raspberry Pi running Processing -> (serial) -> Arduino -> LED strip... Another issue is a timing desync, eg. stroboscope flashes became misaligned between the strips.

    In the future I want to deprecate the Raspis and use a better controller that I can connect to network directly. The Arduino Nanos with ethernet expansion board proved too slow for realtime per-pixel control, as the communication between the Nanos and the ethernet board is using the serial interface. So I'm looking for a microcontroller that can directly translate an image to pixel output, and do it fast enough to get a decent framerate. All I need is time and money...

  • Creating random number generator

    Glad you were able to resolve your issue! If you want further feedback on your solution, share your Arduino code here.... although I am assuming that it is based on the Arduino random number example.

  • Creating random number generator

    I did a bunch of trail and error these past few days. I was able to get it working from the arduino side. Thanks

  • Collision detection between 2 objects with an ultrasonic sensor (Arduino)

    That's the thing...I don't know the origin (x,y) of either image, as the plane is controlled by the data input from the arduino sensor (incoming distance between my hand and the sensor) and the clouds are in an array and programmed to be randomly placed within the sketch. I do however know the width/height of both images, I just don't know the origin (x, y) for either.

  • Collision detection between 2 objects with an ultrasonic sensor (Arduino)

    So I'm working from the code in Step 6 (I will attach below) of this tutorial: http://www.instructables.com/id/How-to-control-a-simple-Processing-game-with-Ardui/

    I am using an HR-SR04 ultrasonic sensor to control the plane, moving it up and down via hand movements.

    What I am trying to do is implement an obstacle feature to the game, by having the score decrease by 1 when the plane hits a cloud. However I can't get the collision detection working for when the plane hits a cloud. The original author has managed to get this working perfectly for when the plane hits the bird but I'm not sure how to get it working between the plane and clouds, I've tried everything I can think of but I'm stuck.

    Any help would be appreciated.

    Below is the code that I'm working from:

    `//Ultrasound plane, a game with a plane and an ultrsound sensor (but
    
    //by Yoruk for Instructables
    
    //send commments or questions to Yoruk16_72 AT yahoo DOT fr
    
    
    //19 07 14 : initial code
    //20 07 14 : it works with arduino !!
    //07 07 15 : picture for the plane and for the grass
    //06 12 15 : score system with the bird
    
    
    int i, j; 
    
    int Score ;
    float DistancePlaneBird;
    
    
    float Hauteur; //en Y
    float Angle;
    int DistanceUltra;
    int IncomingDistance;
    //float Pas; //pour deplacements X
    
    float BirdX;
    float BirdY;
    
    float GrassX ;  //for X position
    
    
    
    
    String DataIn; //incoming data on the serial port
    
    //5 a 32 cm
    
    
    float [] CloudX = new float[6];
    float [] CloudY = new float[6];
    
    //vitesse constante hein
    
    
    PImage Cloud;
    PImage Bird;
    PImage Plane;
    PImage Grass;
    
    
    
    // serial port config
    import processing.serial.*; 
    Serial myPort;    
    
    
    
    //preparation
    void setup() 
    {
    
        myPort = new Serial(this, "/dev/cu.usbmodem1411", 9600); 
    
        myPort.bufferUntil(10);   //end the reception as it detects a carriage return
    
        frameRate(30); 
    
        size(800, 600);
        rectMode(CORNERS) ; //we give the corners coordinates 
        noCursor(); //why not ?
        textSize(16);
    
        Hauteur = 300; //initial plane value
    
    
        Cloud = loadImage("cloud.png");  //load a picture
        Bird = loadImage("bird.png");  
        Plane = loadImage("plane.png");  //the new plane picture
    
            Grass = loadImage("grass.png");  //some grass
    
    
        //int clouds position
        for  (int i = 1; i <= 5; i = i+1) {
            CloudX[i]=random(1000);
            CloudY[i]=random(400);
        }
    
    
        Score = 0;
    }
    
    
    //incoming data event on the serial port
    
    
    void serialEvent(Serial p) { 
        DataIn = p.readString(); 
        // println(DataIn);
    
        IncomingDistance = int(trim(DataIn)); //conversion from string to integer
    
        println(IncomingDistance); //checks....
    
        if (IncomingDistance>1  && IncomingDistance<100 ) {
            DistanceUltra = IncomingDistance; //save the value only if its in the range 1 to 100     }
        }
    }
    
    
    //main drawing loop
    void draw() 
    {
        background(0, 0, 0);
        Ciel(); //draw the sky
        fill(5, 72, 0);
    
    
    
        //rect(0, 580, 800, 600); //some grass
    
        //new grass : 
    
        for  (int i = -2; i <= 4; i = i+1) {  //a loop to display the grass picture 6 times
    
            image(Grass, 224*i  + GrassX, 550, 224, 58);  // 224 58 : picture size
        }
    
        //calculates the X grass translation. Same formulae than the bird
        GrassX = GrassX  -  cos(radians(Angle))*10;
    
        if (GrassX < -224) {  //why 224 ? to have a perfect loop
            GrassX=224;
        }
    
    
        text(Angle, 10, 30); //debug things...
        text(Hauteur, 10, 60); 
    
    
        //new part : check the distance between the plane and bird and increase the score
        DistancePlaneBird = sqrt(pow((400-BirdX), 2) + pow((Hauteur-BirdY), 2)) ;
    
        if (DistancePlaneBird < 40) {
            //we hit the bird   
            Score = Score+ 1;
    
            //reset the bird position
            BirdX = 900;
            BirdY = random(600);
        }
    
        //here we draw the score
        text("Score :", 200, 30); 
        text( Score, 260, 30); 
    
    
    
        //Angle = mouseY-300; //uncomment this line and comment the next one if you want to play with the mouse
        Angle = (18- DistanceUltra)*4;  // you can increase the 4 value...
    
    
    
        Hauteur = Hauteur + sin(radians(Angle))*10; //calculates the vertical position of the plane
    
        //check the height range to keep the plane on the screen 
        if (Hauteur < 0) {
            Hauteur=0;
        }
    
        if (Hauteur > 600) {
            Hauteur=600;
        }
    
        TraceAvion(Hauteur, Angle);
    
        BirdX = BirdX - cos(radians(Angle))*10;
    
        if (BirdX < -30) {
            BirdX=900;
            BirdY = random(600);
        }
    
        //draw and move the clouds
        for  (int i = 1; i <= 5; i = i+1) {
            CloudX[i] = CloudX[i] - cos(radians(Angle))*(10+2*i);
    
            image(Cloud, CloudX[i], CloudY[i], 300, 200);
    
            if (CloudX[i] < -300) {
                CloudX[i]=1000;
                CloudY[i] = random(400);
            }
        }
    
        image(Bird, BirdX, BirdY, 59, 38); //displays the useless bird. 59 and 38 are the size in pixels of the picture
    }
    
    
    void Ciel() {
        //draw the sky
    
        noStroke();
        rectMode(CORNERS);
    
        for  (int i = 1; i < 600; i = i+10) {
            fill( 49    +i*0.165, 118   +i*0.118, 181  + i*0.075   );
            rect(0, i, 800, i+10);
        }
    }
    
    
    void TraceAvion(float Y, float AngleInclinaison) {
        //draw the plane at given position and angle
    
        noStroke();
        pushMatrix();
        translate(400, Y);
        rotate(radians(AngleInclinaison)); //in degres  ! 
    
    
        /*
        Drawing concept :  ;-)
    
         |\___o__
         ________>     
    
         */
    
        scale(0.5);  //0.2 pas mal
    
        //unless drawing the plane "by hands", just display the stored picture instead. Note that the parameters 2 and 3 are half the picture size, to make sure that the plane rotates in his center.
        image(Plane, -111, -55, 223, 110); // 223 110 : picture size
    
    
    
        popMatrix(); //end of the rotation matrix
    }
    
    //file end`
    
  • Creating random number generator

    Ok, this is the code in your arduino. Tell us where do you want to implement the random part? Have you run processing code before? Can your processing code talk to your arduino board using a serial connection?

    You can browse previous posts and find some code suitable for you: https://forum.processing.org/two/search?Search=arduino

    One possible idea is this: Your arduino sends commands via serial. You connect your arduino to your computer (physically) and in Processing, you open the serial port where your arduino is connected. Then, every time your arduino sends any data, your Processing sketch intercepts it and process it. In the processing part, you can generate a random number and displays it on the screen. So for instance, every time you push a button you get a new number in the screen.

    Kf

  • Creating random number generator

    The farthest I've seem to have gotten is simply having my arduino board and button interact with a LED. I don't know how to generate random numbers at all or how to use processing with the button.

    Here is the sketch I have so far.

    void setup() {
      pinMode(2, INPUT);
      pinMode(3, OUTPUT);
    
    }
    
    Void loop() {
      if (digitalRead(2) == HIGH) {
       digitalWrite(3, HIGH);
    } else {
       digitalWrite(3, LOW);
    
    }
    
    }
    
  • Creating random number generator

    1) Can you generate a random number? Like, at all?

    2) Can you display a number? At all?

    3) Can you display the number you generated?

    4) Can you generate a new random number every time you click the mouse?

    5) Can your sketch communicate with your Arduino?

    6) Can your button communicate with Arduino?

    7) Can your sketch get some signal from the Arduino when the button is pressed?

    8) Can you regenerate the random number when that signal is received instead of using a mouse click?

    Break your problem down into smaller problems! More than likely you may be able to tackle some of them yourself... AND IF YOU CAN THEN WE DON'T NEED TO HELP YOU WITH THAT PART. So show us what you have working so far SO WE KNOW WHAT WE DON'T NEED TO HELP YOU WITH. If you don't do that, you're asking us to do the WHOLE THING for you without doing ANYTHING yourself!

  • Creating random number generator

    This is my first time ever using any programming language. I'm trying to create a small button attached to an arduino board that generates a random number from 0-100 on my computer screen while attached via USB. I looked at the reference area to try to figure out what do I write, but I am a bit lost. I could please use some help!

  • Pitch, Roll, Yaw using rotateX/Y/Z query

    When I use just two values, (eg just pitch and roll) the orientation seems to be represented normally. But when I throw the third into the mix, it gets a little wild.

    You will need to check the reference to see what are the range of each angle. Then in your application, you need to define your own range if it is not the same as provided by Android. You will have the same challenge using a generic gyro connected to arduino.

    If you work only with yaw, does it behave as you expect? What are you trying to do by the way? For instance, are you mounting your phone on an UAV?

    Kf

  • Pitch, Roll, Yaw using rotateX/Y/Z query

    Thanks, koogs. I've tried every which combo. No joy. I'll try to get another phone for ref in the near future, or maybe hook up a gyro to arduino instead.

  • Computational Arts MA/MFA @ Goldsmiths - now recruiting for 2018!

    Hi everyone,

    Just dropping a line to say that the department of Computing at Goldsmiths, University of London, is looking to recruit a few more artist-hackers for next year's cohort at the MA/MFA in Computational Arts (starting Sept 2018).

    What will I learn? Using openFrameworks, Arduino, Processing you'll learn machine learning, computer vision, generative art, genetic algorithms, audio-visual programming and so much more in order to make interactive installations, physical objects, robots, phone apps, games etc. Visit the link above for a list of the courses on offer.

    Do I need to know how to code? Not necessarily. About 30% of our students know how to code before they join us. The classes are of varying levels and they cater for all abilities. We value the diversity of skills each person brings in. We have architects, dancers, coders, musicians, writers and many more practitioners on the course!

    Who will teach me? All teaching staff are creative practitioners themselves. Here are some of them: * Prof. Atau Tanaka * Phoenix Perry indie games developer great openFrameworks contributor * Prof. Mick Grierson who led the world's first MOOC in Creative Coding * Rebecca Fiebrink who runs the popular Kadenze course on Machine Learning for Musicians and Artists * Lior Ben Gai - creative technology practitioner * Freida Abtan * Helen Pritchard hacker and critical theorist * Theo Papatheodorou founder of Random Quark creative tech studio

    All members of staff are academics but maintain a strong creative practice too! Furthermore, you'll get regular crit sessions. Guests in the past included Memo Akten and Patrick Tresset, Kyle McDonald, Jane Prophet, Maurice Benayoun, Andrew Shoben and many more!

    What do current students make? * In C++ where virtual perforers take autonomous decisions in real time as they perform Riley's "In C". * A sign glove that translates sign language to sounds and recently won a prestigious hackathon in Korea * Dancers in White where a dancer is performing with robots she made using computer vision * Generative jewelry using online software and 3D printed. Upon graduation student took project to kickstarter, raised 15k, launced her own business * Salty Bitter Sweet is an installation using computer vision + machine learning to "taste" images, uses data to generate shakespear-seeded sonnets.

    For other projects from last year's 2017 graduates have a look here

    Where will I work? You'll be working in state of the art facilities. Goldsmiths Computing unveiled a brand new fabrication space equipped with twelve 3D printers, a £60k laser cutter and a fully stocked electronics lab, all freely accessible to MA/MFA students.

    So, is this all work and no play? Absolutely not! We organise pop-up exhibitions, computational art gallery visits for our students, we take massive field trips. Last year we travelled all together to a Netherlands hackathon and this year 50 of us went to Transmediale in Berlin.

    If this is the kind of work you'd love to be doing, in a interdisciplinary, creative department, please get in touch!

    More info on how to apply go here

    If you have questions let me know by writing to theo@gold.ac.uk

    Dr Theodoros Papatheodorou Lecturer in Computational Arts Computational Arts MA/MFA Programme Leader

  • save and load Array list
    void waitForLoadDialog() { 
      if (!loadPath.equals("")) {
        // waiting is over
        loadIt(); 
        // go back 
        state=normal;
      }
    }
    
    void saveIt() {
      // save
    
      // make array (to save it)
      String[] strs; 
      strs = new String[0]; 
    
      if (activeArrayListHasNumber==0) {
        strs = new String[points1.size()]; 
        int i=0; 
        for (PVector pv : points1) {
          strs[i]=str(pv.x)+","+str(pv.y); 
          i++;
        }//for
      }// 
      else if (activeArrayListHasNumber==1) {
        strs = new String[points2.size()]; 
        int i=0; 
        for (PVector pv : points2) {
          strs[i]=str(pv.x)+","+str(pv.y); 
          i++;
        }//for
      }//else
      else if (activeArrayListHasNumber==2) {
        strs = new String[points3.size()]; 
        int i=0; 
        for (PVector pv : points3) {
          strs[i]=str(pv.x)+","+str(pv.y); 
          i++;
        }//for
      }//else
      else if (activeArrayListHasNumber==3) {
        strs = new String[points4.size()]; 
        int i=0; 
        for (PVector pv : points4) {
          strs[i]=str(pv.x)+","+str(pv.y); 
          i++;
        }//for
      }//else
    
      // check if file extension (fileExtension, e.g. .txt) is there 
      int len = savePath.length(); 
      if (len<4 || !savePath.substring( len-4 ).equals(fileExtension)) {
        // file Extension is not present, we have to add it
        savePath += fileExtension; // add the file Extension
      } 
    
      // save 
      println("Saved: " + savePath); 
      saveStrings( savePath, strs );
    
      // get file name for list 
      fileNames[activeArrayListHasNumber] =  nameFromPath(savePath);
    } //func
    
    void loadIt() {
      // load
      if (activeArrayListHasNumber==0)
      {
        points1.clear();
      } else if (activeArrayListHasNumber==1)
      {
        points2.clear();
      } else if (activeArrayListHasNumber==2)
      {
        points3.clear();
      } else if (activeArrayListHasNumber==3)
      {
        points4.clear();
      }
    
      fileNames[activeArrayListHasNumber] =  nameFromPath(loadPath); 
    
      String[] strs = loadStrings( loadPath ); 
      for (String s : strs) {
        String[] thisLine=split(s, ","); 
    
        if (activeArrayListHasNumber==0) 
        {
          points1.add(new PVector(float(thisLine[0]), float(thisLine[1])));
        } else if (activeArrayListHasNumber==1)
        {
          points2.add(new PVector(float(thisLine[0]), float(thisLine[1])));
        } else if (activeArrayListHasNumber==2)
        {
          points3.add(new PVector(float(thisLine[0]), float(thisLine[1])));
        } else if (activeArrayListHasNumber==3)
        {
          points4.add(new PVector(float(thisLine[0]), float(thisLine[1])));
        }//else
        //
      }//for
    }//func 
    
    // -------------------------------------------------
    
    void showData1() {
      //
      // show data 1
    
      PVector prev = new PVector(-1, -1); 
      int y=50; 
    
      if (activeArrayListHasNumber==0) {
        stroke(255, 2, 2); // RED
        line (10, 10, 198, 10);
      }
    
      for (PVector pv : points1) {
    
        if (showText) {
          fill(255, 2, 2); // RED 
          // show data
          text(pv.x, 30, y); 
          text(pv.y, 110, y);
        }
    
        fill(0, 2, 2); 
        stroke(255, 2, 2); // RED 
        float yvalue = map( pv.y, 0, height, 300, 355); 
        if (prev.x!=-1) {
          line(10 + pv.x*3, yvalue, 
            prev.x, prev.y);
        }
        noStroke(); 
        // ellipse (10 + pv.x*3, yvalue, 4, 4);
        prev = new PVector(10 + pv.x*3, yvalue); 
    
    
        y+=20; //next line
      }//for
    
      if (showText) {
        // middle line 
        stroke(255, 2, 2); // RED 
        line( 100, 30, 100, height);
    
        // double middle lines!!!   
        stroke(0); // BLACK 
        int x1=200; 
        line( x1-2, 30, x1-2, height); 
        line( x1+2, 30, x1+2, height);
      }
      //
    }
    
    void showData2() {
      //
      // show data 2 
    
      if (activeArrayListHasNumber==1) {
        // activeArrayListHasNumber is FALSE, right side is active
        stroke(2, 255, 2); // GREEN
        line (200, 10, 
          350, 10);
      }
    
      PVector prev = new PVector(-1, -1); 
      int y=50; 
      for (PVector pv : points2) {
    
        if (showText) {
          fill(0, 255, 2); // GREEN 
          // show data
          text(pv.x, 210, y); 
          text(pv.y, 210+80, y);
        }
    
        fill(0, 2, 2); 
        stroke(0, 255, 2); // GREEN 
        float yvalue = map( pv.y, 0, height, 300, 355); 
        if (prev.x!=-1) {
          line(10 + pv.x*3, yvalue, 
            prev.x, prev.y);
        }
        noStroke(); 
        //   ellipse (10 + pv.x*3, yvalue, 4, 4);
        prev = new PVector(10 + pv.x*3, yvalue); 
    
        y+=20; //next line
      }//for
    
      if (showText) {
        // middle line 
        stroke(0, 255, 2); // GREEN 
        line( 288, 30, 288, height);
    
        // double middle lines!!!   
        stroke(0); // BLACK 
        int x1=210+80+80; 
        line( x1-2, 30, x1-2, height); 
        line( x1+2, 30, x1+2, height);
      }
      //
    }
    
    void showData3() {
      //
      // show data 3
    
      color col3 = color(0, 2, 255); // BLUE 
    
      if (activeArrayListHasNumber==2) {
        // activeArrayListHasNumber is FALSE, right side is active
        stroke(col3); // 
        line (400, 10, 
          550, 10);
      }
    
      PVector prev = new PVector(-1, -1); 
      int y=50; 
      for (PVector pv : points3) {
    
        fill(col3); // Blue 
    
        if (showText) {
          // show data
          text(pv.x, 210+180, y); 
          text(pv.y, 210+180+80, y);
        }
    
        fill(0, 2, 2); 
        stroke(col3); // blue 
        float yvalue = map( pv.y, 0, height, 300, 355); 
        if (prev.x!=-1) {
          line(10 + pv.x*3, yvalue, 
            prev.x, prev.y);
        }
        noStroke(); 
        //   ellipse (10 + pv.x*3, yvalue, 4, 4);
        prev = new PVector(10 + pv.x*3, yvalue); 
    
        y+=20; //next line
      }//for
    
      if (showText) {
        // middle line 
        stroke(col3); // blue 
        line( 467, 30, 467, height);
    
        // double middle lines!!!   
        stroke(0); // BLACK 
        int x1=210+180+80+80; 
        line( x1-2, 30, x1-2, height); 
        line( x1+2, 30, x1+2, height);
      }
      //
    }
    
    void showData4() {
      //
      // show data 4 
    
      color col4 = color(155, 255, 112); 
    
      if (activeArrayListHasNumber==3) {
        // activeArrayListHasNumber is FALSE, right side is active
        stroke(col4); // 
        line (570, 10, 
          710, 10);
      }
    
      PVector prev = new PVector(-1, -1); 
      int y=50; 
      for (PVector pv : points4) {
    
        fill(col4); //  
    
        if (showText) {
          // show data
          text(pv.x, 210+180+180, y); 
          text(pv.y, 210+180+180+80, y);
        }
    
        fill(0, 2, 2); 
        stroke(col4); //  
        float yvalue = map( pv.y, 0, height, 300, 355); 
        if (prev.x!=-1) {
          line(10 + pv.x*3, yvalue, 
            prev.x, prev.y);
        }
        noStroke(); 
        //   ellipse (10 + pv.x*3, yvalue, 4, 4);
        prev = new PVector(10 + pv.x*3, yvalue); 
    
        y+=20; //next line
      }//for
    
      if (showText) {
        // middle line 
        stroke(col4); //  
        line( 210+180+180+80-4, 30, 210+180+180+80-4, height);
      }
      //
    }
    
    // ---------------------------------------------------------------
    
    void serialEvent(Serial p) { 
      inString = p.readString(); 
      char primo=inString.charAt(0); // primo carattere
      String cifra=inString.substring(1); // da secondo carattere in poi
      float val=parseFloat(cifra); // valore da 0-255 o 0-1023, non sò cosa spedisce arduino
    
    
      print("val="); 
      println(val); 
    
      //   inString = trim(inString);
    
      //    // converte in int e mappa all'altezza dello schermo: 
    
    
      switch(primo) { 
        case ('A') : 
        myKnob1.setValue(val); 
        break; 
        case ('B') : 
        myKnob2.setValue(val); 
        break; 
        case ('C') : 
        myKnob3.setValue(val); 
        break; 
        case ('D') : 
        myKnob3.setValue(val); 
        break;
      }
    }
    
    void goBackToMainState() {
    
      // from help screen back to main screen
    
      // buttons ON 
      myKnob1.setVisible(true); 
      myKnob2.setVisible(true); 
      myKnob3.setVisible(true); 
      myKnob4.setVisible(true); 
    
      //go back to main screen 
      state=normal;
    
      // kill Esc so we stay in the program 
      key=0;
    }
    
    void  backspaceOnActiveList() {
    
      // for the key BACKSPACE 
    
      switch (activeArrayListHasNumber) {
    
      case 0:
        if (points1.size()>0)
          points1.remove(points1.size()-1);
        break; 
    
      case 1:
        if (points2.size()>0)
          points2.remove(points2.size()-1);
        break;
    
      case 2:
        if (points3.size()>0)
          points3.remove(points3.size()-1);
        break;
    
      case 3:
        if (points4.size()>0)
          points4.remove(points4.size()-1);
        break;
      }//switch
      //
    }//func 
    
    // ------------------------------------------------
    // tools
    
    String nameFromPath(String fileName1) {
    
      File file = new File(fileName1);
      String result = file.getName();
      return result;
    } //func 
    //
    
  • save and load Array list

    you are not making progress

    only I make progress

    can you read arduino data and fill in table 1 please?

  • two arduinos changing coloured circles on processing
    serial arduino1;
    serial arduino2;
    
    void serialEvent(Serial serialObj) {
    
      if(serialObj == arduino1)
         //Data from first arduino
    
    
      if(serialObj == arduino2)
         //Data from second unit
    }
    

    Kf

  • two arduinos changing coloured circles on processing

    Hi,

    I'm a student new to coding and am trying to get two arduinos, (connected via serial port) to change the colour of two different ellipses on processing. Both arduinos have a simple push button.

    One ellipse changes colour when one arduino button is pressed (this part is fine) But when I start to introduce the second arduino the coloured ellipses just flash quickly between the colours.

    Is there a way to connect the two arduinos successfully? My code is posted below.

    Thank you, Jade ![](> > )

    import processing.serial.*;

    import processing.serial.*; Serial port; Serial portss; PImage[] img = new PImage[1]; int val = 0;

    void setup () { size (1000, 707);

    img [0] = loadImage ("nocolouredblobs.jpg"); background(img [0]);

    fill(#459839);
    ellipse(931,68,75,75);

    port = new Serial(this, Serial.list()[3], 9600); }

    void draw() { if (port.available() > 0) { val = port.read(); }

    if (val == 2) { fill (#EDB137); ellipse (833, 68, 75, 75); fill (#FFDE9B); ellipse (931,68,75,75); } else { fill (#459839); ellipse (833, 68, 75, 75); fill (#459839); ellipse (931,68,75,75); }

    }

  • Need advice for an HD video with 7.1 sound project

    Well, doing some research I now think that the best option could be using launch()to open the file on an external player (like VLC). It would be awesome to have some kind of communication with the player, I found posts about an old library for Processing 1 called RemoteVLC, is there a modern option to control the player from Processing? (to know, for example, when a video starts or finishes playing)

    I still need to use Processing (or something similar) to send synchronized info via serial to an Arduino while the video is playing.