Pages: [1]   Go Down
Author Topic: arduino & max/msp connection  (Read 522 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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);

   }
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 239
Yeah Arduino surely rocks !
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Pages: [1]   Go Up
Jump to: