rudavis123
Published © GPL3+

Want to be an artistic amateur iron man?

If you have ever dreamed about being a super hero, here is your chance to begin the adventure.

BeginnerShowcase (no instructions)216
Want to be an artistic amateur iron man?

Things used in this project

Hardware components

ProtoSnap - LilyPad Development Board
SparkFun ProtoSnap - LilyPad Development Board
×1
Thread (Non-Conductive)
×1
Felt Fabric
×1
Knit Glove
×1

Story

Read more

Schematics

Artistic Iron Man Glove Schematic

Open and close your hand to control the sound and LEDs of the glove

Code

Artistic Iron Man Glove Code

Arduino
// The dark variable determines when we turn the LEDs on or off. 
// Set higher or lower to adjust sensitivity.
const int darkLevel = 10;

// Create a variable to hold the readings from the light sensor.
int lightValue;

// Set which pin the Signal output from the light sensor is connected to
// If using the LilyPad Development Board, change this to A6
int sensorPin = A2;

// Set which pin the LED is connected to. 
// Set to 13 if you'd rather use the LilyPad Arduino's built-in LED.
int ledPin = 5;


int buzzer = A3;
int NOTE_B0 = 31;
int NOTE_C1 = 33;
int NOTE_CS1 = 35;
int NOTE_D1 = 37;
int NOTE_DS1 = 39;
int NOTE_E1 =  41;
int NOTE_FS1 = 46;
int NOTE_G1 = 49;
int NOTE_GS1 = 52;
int NOTE_A1 = 55;
int NOTE_AS1 = 58;
int NOTE_B1 = 62;
int NOTE_C2 = 65;
int NOTE_CS2 = 69;
int NOTE_D2 = 73;
int NOTE_DS2 = 78;
int NOTE_E2 = 82;
int NOTE_F2 = 87;
int NOTE_FS2 = 93;
int NOTE_G2 = 98;
int NOTE_GS2 = 104;
int NOTE_A2 = 110;
int NOTE_AS2 = 117;
int NOTE_B2 = 123;
int NOTE_C3 = 131;
int NOTE_CS3 = 139;
int NOTE_D3 = 147;
int NOTE_DS3 = 156;
int NOTE_E3 = 165;
int NOTE_F3 = 175;
int NOTE_FS3 = 185;
int NOTE_G3 = 196;
int NOTE_GS3 = 208;
int NOTE_A3 = 220;
int NOTE_AS3 = 233;
int NOTE_B3 = 247;
int NOTE_C4 = 262;
int NOTE_CS4 = 277;
int NOTE_D4 = 294;
int NOTE_DS4 = 311;
int NOTE_E4 = 330;
int NOTE_F4 = 349;
int NOTE_FS4 = 370;
int NOTE_G4 = 392;
int NOTE_GS4 = 415;
int NOTE_A4 = 440;
int NOTE_AS4 = 466;
int NOTE_B4 = 494;
int NOTE_C5 = 523;
int NOTE_CS5 = 554;
int NOTE_D5 = 587;
int NOTE_DS5 = 622;
int NOTE_E5 = 659;
int NOTE_F5 = 698;
int NOTE_FS5 = 740;
int NOTE_G5 = 784;
int NOTE_GS5 = 831;
int NOTE_A5 = 880;
int NOTE_AS5 = 932;
int NOTE_B5 = 988;
int NOTE_C6 = 1047;
int NOTE_CS6 = 1109;
int NOTE_D6 = 1175;
int NOTE_DS6 = 1245;
int NOTE_E6 = 1319;
int NOTE_F6 = 1397;
int NOTE_FS6 = 1480;
int NOTE_G6 = 1568;
int NOTE_GS6 = 1661;
int NOTE_A6 = 1760;
int NOTE_AS6 = 1865;
int NOTE_B6 = 1976;
int NOTE_C7 = 2093;
int NOTE_CS7 = 2217;
int NOTE_D7 = 2349;
int NOTE_DS7 = 2489;
int NOTE_E7 = 2637;
int NOTE_F7 = 2794;
int NOTE_FS7 = 2960;
int NOTE_G7 = 3136;
int NOTE_GS7 = 3322;
int NOTE_A7 = 3520;
int NOTE_AS7 = 3729;
int NOTE_B7 = 3951;
int NOTE_C8 = 4186;
int NOTE_CS8 = 4435;
int NOTE_D8 = 4699;
int NOTE_DS8 = 4978;

void setup()
{
    // Set sensorPin as an INPUT
    pinMode(A2, INPUT);

    // Set LED as outputs
    pinMode(ledPin, OUTPUT);

    // Set pin A5 to use as a power pin for the light sensor
    // If using the LilyPad Development Board, comment out these lines of code
    pinMode(A5, OUTPUT);
    digitalWrite(A5, LOW);

    pinMode(6, OUTPUT);
    digitalWrite (6, LOW);

    pinMode (A7, OUTPUT);
    digitalWrite (A7, LOW);

    pinMode (A8, OUTPUT);
    digitalWrite (A8, LOW);    

    // Initialize Serial, set the baud rate to 9600 bps.
    Serial.begin(3);

    pinMode(A3, OUTPUT);

    int buzzer = A3;

    int NOTE_C5 = 523;

    int tempo = 500;

// Map musical notes to their frequencies by creating variables for them.
// You can find the frequencies for higher and lower notes at:
// https://www.arduino.cc/en/Tutorial/toneMelody

// We'll also create a variable for how long to play each note in milliseconds.
// If you make this smaller, the notes will play faster.


}

void loop()
{
    // Read the light sensor's value and store in 'lightValue'
    lightValue = analogRead(A2);

    // Print some descriptive text and then the value from the sensor
    Serial.print("Light value is:");
    Serial.println(lightValue);

    // Compare "lightValue" to the "dark" variable
    if (lightValue <= darkLevel) // If the reading is less then 'darkLevel'
    {
        noTone(buzzer); // Play note D5
        digitalWrite (ledPin, LOW);
        digitalWrite (A5, LOW);
        digitalWrite (6, LOW);
        digitalWrite (A7, LOW); 
        digitalWrite (A8, LOW);      
    }
    else // Otherwise, if "lightValue" is greater than "dark"
    {
        digitalWrite (ledPin, HIGH);
        digitalWrite (A5, HIGH);
        digitalWrite (6, HIGH);
        digitalWrite (A7, HIGH);
        digitalWrite (A8, HIGH);
        
        tone (A3,NOTE_B0);
        delay(100);
        tone(A3,NOTE_C1);  // Play nOTE
        delay(10);
        tone(A3,NOTE_CS1);  // Play nOTE
        delay(100);
        tone(A3,NOTE_D1);  // Play nOTE
        delay(100);     
        tone(A3,NOTE_DS1);  // Play nOTE
        delay(100);
        tone(A3,NOTE_E1);  // Play nOTE
        delay(50);
        tone(A3,NOTE_FS1);  // Play nOTE
        delay(50);  
        tone(A3,NOTE_G1);  // Play nOTE
        delay(50);
        tone(A3,NOTE_GS1);  // Play nOTE
        delay(50);
        tone(A3,NOTE_A1);  // Play nOTE
        delay(50); 
        tone(A3,NOTE_AS1);  // Play nOTE
        delay(50);
        tone(A3,NOTE_B1);  // Play nOTE
        delay(50);
        tone(A3,NOTE_C2);  // Play nOTE
        delay(50);
        tone(A3,NOTE_CS2);  // Play nOTE
        delay(50);
        tone(A3,NOTE_D2);  // Play nOTE
        delay(50);     
        tone(A3,NOTE_DS2);  // Play nOTE
        delay(50);
        tone(A3,NOTE_E1);  // Play nOTE
        delay(50);
        tone(A3,NOTE_F2);  // Play nOTE
        delay(50);
        tone(A3,NOTE_FS2);  // Play nOTE
        delay(50);  
        tone(A3,NOTE_G2);  // Play nOTE
        delay(50);
        tone(A3,NOTE_GS2);  // Play nOTE
        delay(50);
        tone(A3,NOTE_A2);  // Play nOTE
        delay(50); 
        tone(A3,NOTE_AS2);  // Play nOTE
        delay(50);
        tone(A3,NOTE_B2);  // Play nOTE
        delay(50);
        tone(A3,NOTE_C3);  // Play nOTE
        delay(50);
        tone(A3,NOTE_CS3);  // Play nOTE
        delay(50);
        tone(A3,NOTE_D3);  // Play nOTE
        delay(50);     
        tone(A3,NOTE_DS3);  // Play nOTE
        delay(50);
        tone(A3,NOTE_E3);  // Play nOTE
        delay(50);
        tone(A3,NOTE_F3);  // Play nOTE
        delay(50);
        tone(A3,NOTE_FS3);  // Play nOTE
        delay(50);  
        tone(A3,NOTE_G3);  // Play nOTE
        delay(50);
        tone(A3,NOTE_GS3);  // Play nOTE
        delay(50);
        tone(A3,NOTE_A3);  // Play nOTE
        delay(50); 
        tone(A3,NOTE_AS3);  // Play nOTE
        delay(50);
        tone(A3,NOTE_B3);  // Play nOTE
        delay(1000);
        noTone(buzzer); // Play note D5
    }

    // Delay so that the text doesn't scroll to fast on the Serial Monitor. 
    // Adjust to a larger number for a slower scroll.
    delay(2000);
}

Credits

rudavis123
0 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.