arduivis

a bi-directional communication paradigm for programming languages & microcontrollers

Getting Started FAQ Projects
    MaxMSP Pure Data Python NodeJS

    MaxMSP Model #3: Feedback

    Video Example

    Arduino

    /*
    
    ~~~~~~~ arduivis - MaxMSP ~~~~~~~
    ~~~~~~~~ model#3: feedback ~~~~~~~~~
    
    MaxMSP: arduivis_model3_feedback.maxpat
    
    This is an example of to read sliders from PD. 
    An Arduino reads and parses this data, sending
    it from the Arduino and back into PD. This 
    feedback data is then sent back to the Arduino
    from Pure Data, controlling the PWM of a LED.
    
    This code is in the public domain
      
    written by Christopher Konopka
    http://cskonopka.github.io/arduivis/
    http://christopherkonopka.com/
    
    */
    
    void setup() 
    {
      // Create/open serial port  
      Serial.begin(9600);      
    
      // Define LED mode 
      // PWM LED    
      pinMode(3, OUTPUT);    
    }
    
    void loop() 
    {
    
      // Slider from MaxMSP 
        int maxmspSlider;
        
      // Feedback input from MaxMSP
        int feedbackInput;
    
      // Parse incoming MaxMSP slider values
      // from MaxMSP, to Arduino    
        maxmspSlider = Serial.parseInt();  
    
      // MaxMSP Slider values to serial buffer
      // [serial] object
      // to MaxMSP, from Arduino       
        Serial.print(maxmspSlider); 
        Serial.print(" ");
    
      // Feedback Input
      // From MaxMSP
        feedbackInput = Serial.parseInt();
    
      // Write parsed feedback values to LEDs
      // Fading LED
      // from MaxMSP, to Arduino    
        analogWrite(3, feedbackInput);
    
      // MaxMSP feedback values to serial buffer
      // [serial] object
      // to MaxMSP, from Arduino       
        Serial.println(feedbackInput);    
    }
    

    MaxMSP

    Presentation Mode

    some_text