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!

Leave a comment