Go Down

Topic: Communication between Arduino and Max Msp  (Read 319 times) previous topic - next topic

Eleonore258

Hi, i am trying to realize a project. And i am a little bit lost.
I am trying to have a bang in Max msp by pressing a push button on arduino. I have red all the documentation of Maxuino but i was thinking that i could just use the serial fonction on max msp maybe. Do you have any other documentations or recommendation to realize that?


here is my code but the led13 doesn't light up and  i am not sure why it's not working. :(

Code: [Select]
const int buttonPin = 2;
const int ledPin = 13;
 
int buttonState = 0;
int lastButtonState = 0;
int randVal =0;
int randValZ =0;
 
void setup() {
  // put your setup code here, to run once:
pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);

}

void loop() {
  // put your main code here, to run repeatedly:
randVal = random(1000);
randValZ = random(1000);

buttonState = digitalRead(buttonPin);

if (buttonState != lastButtonState) {


 if(buttonState == HIGH) {
 
 }else{
  Serial.println(randVal);
 
  }
   delay(500);
   
 }

 lastButtonState = buttonState;
 
}

slipstick

Where in that code do you think that you have asked the LED light up?

Steve

CLK

Does anything come up in Max? A number? A message? As long as you see something in Max, it is possible to change it to a bang that you need. Such as, if you see only 1 and 0, you can use the [match 1] object to send out a bang only when there are 1's. Or, if you are getting a wide range of numbers (0-1023), set a threshold on it. Such as an object that says [if $f1 > 1000 then bang].

Go Up