Go Down

Topic: arduino & max/msp connection (Read 531 times) previous topic - next topic

kain_leo

Hi,
I'd like using button in arduino to control audio in Max/msp, I just runing the following code but it show " 'button' does not name a type. can someone help me resolve this problem? T~T
------------------------------------------------------------------------------------
  #include <Button.h>

int buttonPin = 2;                   
int ledPin = 13;

Button button = Button(buttonPin,BUTTON_PULLUP_INTERNAL);

void setup()
{
   Serial.begin(9600);
   digitalWrite (ledPin, LOW);
}

void loop() {

   while(1) {

      if(button.isPressed()){
         digitalWrite(ledPin,HIGH);
         Serial.println("1");
         } else {
            digitalWrite(ledPin,LOW);
            Serial.println("0");
         }
      }

      delay(100);

   }

DanDare

Hello,

Guess you need to install "Button.h" library to be able to run this sketch. Seems that this library doesnt come with Arduino by default.

See:
http://playground.arduino.cc/Code/Button
and
http://arduino.cc/en/Guide/Libraries

Go Up