New Code: Sound Reactive Nightgown

I received some code from Kurt for the arduino that is similar to the code created for the Sound Reactive Nightgown:

//////////////////////////////////////////////////

int ledPin = 13;                // LED connected to digital pin 13
int audPin = 0;
int val = 0;

void setup()                    // run once, when the sketch starts
{
pinMode(ledPin, OUTPUT);      // sets the digital pin as output
pinMode(audPin, INPUT);
Serial.begin(9600);
}

void loop()                     // run over and over again
{
val = analogRead(audPin);
Serial.println(val);

if (val < 300) {
myMove();
return;  //check this in the references // also try “exit;”
}
else {
digitalWrite(ledPin, LOW);    // sets the LED off
}
}

void myMove() {
digitalWrite(ledPin, HIGH);   // sets the LED on
}

/////////////////////////////////////////////////////////

Thanks!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s