//first, setup the pins const int ledPin=3; const int buttonPin=2; const int sensorPin=A0; int buttonState=0;//variable for reading the button status int sensorVal=0; void setup() { pinMode(ledPin, OUTPUT); pinMode(buttonPin, INPUT); Serial.begin(9600); //9600bits per second for the speed } void loop() { buttonState= digitalRead(buttonPin);//read the state of the button value sensorVal= analogRead(sensorPin);//analog default is like:1~1023, which is too big for max msp sensorVal= map(sensorVal, 0, 1023, 0, 255);//scale the analog value down(from 1~1023 to 1~255) if(buttonState== HIGH){ //check if the button is pressed. digitalWrite(ledPin, HIGH); Serial.println(buttonState);//printline }else{ digitalWrite(ledPin, LOW); Serial.print(buttonState); } Serial.print(" "); Serial.print(sensorVal); Serial.print(" "); Serial.print(sensorVal*2); Serial.println(); }