a bi-directional communication paradigm for programming languages & microcontrollers
Getting Started FAQ ProjectsArduino
/*
~~~~~~~ arduivis - MaxMSP ~~~~~~~
~~~~~~~~ model#2: input ~~~~~~~~~
MaxMSP: arduivis_model2_MaxMSP_input.maxpat
This is an example of how to read a slider from
MaxMSP and write the values to a PWM LED connected
to an Arduino.
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(ledpin, OUTPUT);
}
void loop()
{
// Slider from MaxMSP
int maxmspSlider;
// Parse incoming MaxMSP slider values
// from MaxMSP, to Arduino
maxmspSlider = Serial.parseInt();
// Write parsed values to LEDs
// Fading LED
// from MaxMSP, to Arduino
analogWrite(3, maxmspSlider);
}
MaxMSP
Presentation Mode