Go Down

Topic: arduino & max/msp connection (Read 568 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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy