Introduction
The EagLED can be used with external components such as a sound sensor module.Â
In this guide, create a sound-activated light-up accessory with the EagLED, a sound sensor module, conductive thread, and felt fabric.
Complete this simple guide and incorporate it into your next wearable electronic costume or accessory.
Tools
-
-
-
const int sensorPin = A9; // analog input pin for sound sensor const int ledPin = 10; // pin for LED const int threshold = 850; int sensorValue = 0; // variable to store the value coming from the sensor void setup () { pinMode(sensorPin, INPUT); pinMode (ledPin, OUTPUT); Serial.begin (9600); } void loop () { sensorValue = analogRead(sensorPin); if (sensorValue >= threshold){ digitalWrite (ledPin, HIGH); } else{ digitalWrite (ledPin, LOW); } Serial.println (sensorValue, DEC); }
-
-
-
-
-
const int sensorPin = A9; // analog input pin for sound sensor const int ledPins[] = {6, 10, 12}; // pins for LEDs const int threshold = 850; int sensorValue = 0; // variable to store the value coming from the sensor int pinCount = 3; //the number of pins used (i.e. the length of the array) void setup () { pinMode(sensorPin, INPUT); for (int thisPin = 0; thisPin < pinCount; thisPin++) { pinMode(ledPins[thisPin], OUTPUT); } Serial.begin (9600); } void loop () { sensorValue = analogRead(sensorPin); if (sensorValue >= threshold) { for (int thisPin = 0; thisPin < pinCount; thisPin++) { digitalWrite(ledPins[thisPin], HIGH); } } else { for (int thisPin = 0; thisPin < pinCount; thisPin++) { digitalWrite(ledPins[thisPin], LOW); } } Serial.println (sensorValue, DEC); }
-