Updates from aisencc RSS Toggle Comment Threads | Keyboard Shortcuts

  • aisencc 10:10 pm on May 17, 2012 Permalink | Reply  

    POPmatrix Research Paper 

    PopMatrix: Tongue Display Unit

     
  • aisencc 4:33 pm on May 15, 2012 Permalink | Reply  

    Pop Matrix Final Presentation 

    Presentation Link: PopMatrix

     
  • aisencc 12:43 am on May 11, 2012 Permalink | Reply  

    Conference Paper CHI format 

    This particular template is for the NIME conference : nime-template

     

    This was my paper entry: Chacin_Aisen_Play-A-Grill

     

     

     
  • aisencc 10:37 pm on April 26, 2012 Permalink | Reply
    Tags:   

    Pop Matrix "Thesis Draft" 

    Pop Matrix is a new kind of pop art. This device displays images on your tongue through a series of electrodes. Using sensory substitution, the device trains the user’s brain to translate tactile to visual information will begin to see the images displayed on their tongues.

     
  • aisencc 8:54 pm on April 23, 2012 Permalink | Reply  

    electric pop 

    electric pop
    This is the first prototype of the electric pop. The second phase is to run the code on it and *fingers crossed* hope it works. Craftmanship was done with patience, so there is hope!
    The other issue is the rights to this work. Beta tank created a look and feel prototype for this device, the idea of this device belongs to Bach-Y-Rita, and Hoeken has open-sourced his hardware and software maps, which leaves me as an integrator. Measuring up all the cooks in this kitchen I am becoming a bit uneasy about following this project– suggestions?

     
  • aisencc 5:56 pm on April 22, 2012 Permalink | Reply  

    Reblogged from MAKE:

    Click to visit the original post
    • Click to visit the original post
    • Click to visit the original post
    • Click to visit the original post
    • Click to visit the original post
    • Click to visit the original post
    • Click to visit the original post
    • Click to visit the original post

    Pictured above, a counterfeit Arduino

    I’m a 15-minute walk from Canal Street, NYC, home of counterfeit everything. Men and women from around the world stand shoulder to shoulder shouting “Looyee-Vatton, DVD, Roll-Ex.” Tourists flock to this location looking for a cheap deal on a knockoff purse or watch — some tourists think they’re real, most just want a deal. When you build a brand that represents something of value, eventually you get knocked off.

    Read more… 1,696 more words

    Wow! Society is moving in the right direction! People want to prototype micro controller projects so much, there is an opportunity for counterfeit merchandise! Hurray!!! LV, Coach and broke fashionistas- Electronics and open source hardware is what’s up! - Just the optimistic side of things…
     
  • aisencc 10:04 pm on April 12, 2012 Permalink | Reply  

    TDU 

    https://docs.google.com/presentation/d/19wnwX8ttQQG6aSi-l_yKB6tTzrUWpGu7rSfNW-yoMoE/edit

     
  • aisencc 9:59 pm on April 9, 2012 Permalink | Reply  

    Domains and Ideas 

     

    Ideas:

    1. Tongue Display Unit Art Show
    2. RainRoom
    3. Grow a Meal on my Window
    4. Vending Machine
    5. Experiments with Tactile Sound
    6. Octopod for a Quadriplegic
    7. Summer Pool- Underwater art show
    8. Falling art fall exhibition
    9. Designing wearables for Body Evolution
    10. Designing new species / chimeras / alternate pasts and futures of the human body
    11. Super powered Disabled/ Ballet Mechanique
    12. Open Ocean Architecture- International Museum Sub
    13. More bio-tech- device development
     
    • aisencc 10:18 pm on April 9, 2012 Permalink | Reply

      What are the 2 favored & 2 least favored?
      I have taken the opportunity to hash out all of the ideas that have been floating in my head for quite some time now. There is a huge range of them some are more practical than others, and many of them require dreaming amounts of money.
      In a perfect world if funding or time was not an issue my dream is to build a round structure that travels through under water the oceans. I would love to research round non-fixed architecture, submarines, among other naval structures to combine them into one museum that has traveling exhibitions. This idea touches on the use of international waters as much as the world citizen idea of new merging cultures.
      The second most interesting idea is the Tongue Display Unit because it has already captured me, and began working on it. This idea touches on the fields and domain that I am currently working in.
      2 least likely:
      pool artshow
      fall exhibit

      • aisencc 12:01 am on April 10, 2012 Permalink | Reply

        14. Capturing body heat in one’s sleep to warm up the water for a morning shower
        15. Biodegradable business

  • aisencc 9:17 pm on April 5, 2012 Permalink | Reply  

    Theater Safety Glasses 

    New VIDEO!!

    These glasses cover your eyes at the sight of any dangerous or enervating situation. They are especially useful at the movie theater, when presented with excruciating graphic scenes enough for covering one’s eyes. The glasses have a pulse sensor on an earring clipped to one of the lobes. When the sensor detects an exaltation in pulse servos on both sides of the glasses will close the curtains covering both eyes, and when the pulse reaches normality the curtains retrieve.

     
  • aisencc 5:38 am on March 23, 2012 Permalink | Reply  

    TSG phase 2 

    I have cleaned up my code and redesigned the pcb to a smaller more compact circuit. Tomorrow Joel Murphy will walk me through the pcb etching machine to print the board out. I am very happy about how it turned out. You can see an image here: 

    Image

    I have picked out the new fabric:

    Image

    In order to finish Theater Safety Glasses 2 I will attend Rhino workshop on Saturday to print the part that encases the battery circuit and servos, and assemble the pieces tighter. Creating a circuit for it has been spending and I hope that creating a 3d file will be as rewarding and useful.

     
  • aisencc 10:28 pm on March 19, 2012 Permalink | Reply
    Tags:   

    Theater Safety Glasses 


    Known and Unknown Challenges:
    The Theater Safety Glasses are an old idea that I am refurbishing to create a second version. The main intent is to take a good idea in the first prototype stage and take it further. To begin the Arduino board needs to be stripped from the circuit, therefore I began my technical implementation with creating a new circuit to be etched. An immense challenge was to configure all of the elements comfortably on to the glasses. I have found that I need to make a 3d-printed part for this project in order to incorporate the circuit, battery, servos and curtain.
    KNOWN: battery is huge, first etching of pcb.
    UNKOWN: 3d modeling, it’s not Christmas time… so it’s harder to find red velvet cloth : /

    Easter Egg Experiences:
    When thinking of how to recreate this project I found the new challenge of detaching from the previous image to make a new one. Unfortunately I have not been able to come up with a better look and feel, I am just making the electronics, the user experience, and the design tighter.
    Rhino is free, and there are a ton of tutorials online.
    I love designing pcbs.

     
  • aisencc 10:15 pm on March 19, 2012 Permalink | Reply  

    Refurbishing Theater Safety Glasses

     
  • aisencc 9:54 pm on March 6, 2012 Permalink | Reply  

    Fish-Out-Of-Water 

    Fish-Out-Of-Water is a project that explores the mimicry of life with light and sound. I decided to use motors in order to create movement, and from the movement itself comes the sound. The fist iteration was done with a vibration motor. The second iteration was done with two servos, but there were lots of problems with keeping the cables out of their way. The movement, however, improved significantly.

     

     
  • aisencc 12:23 am on March 6, 2012 Permalink | Reply  

    Synth 

    This is my music box synthesizer. The concept was to miss-and-match, sounds depending on the buttons pressed and the combinations, and the potentiometer changes notes or delays depending on the button pressed.

     
  • aisencc 11:18 pm on February 16, 2012 Permalink | Reply  

    Desert Terrarium 

     
    • aisencc 11:24 pm on February 16, 2012 Permalink | Reply

      This project was surprising in all aspects. Having left the practice of making projects every week since the brake reminded me that it is practice that makes perfect. It is important to keep these skills current. The delay threw me off! having to rename it so it can be checked and not interfere with other commands was the most unexpected challenge this project brought to me. Also, I forgot how fun it can be to find beautiful colors rather than have the cycling rainbow effect. This project brought me back to my earthy roots, I am glad to incorporate sand and its other state silicon.

  • aisencc 11:33 pm on December 22, 2011 Permalink | Reply  

    Safety Glasses 

    The concept of the Safety Glasses project is inspired by the Joo Janta 200 Super-Chromatic Peril Sensitive Sunglasses of tThe Hitchhiker’s Guide to the Galaxy. These glasses turned completely black at the sight of any danger, to give a relaxed attitude when presented with an alarming situation.
    I made a pair of glasses that cover your eyes when you are scared or nervous. These would be specially useful at the movie theater, where some graphic scenes are excruciating enough for covering your eyes. The glasses would have the pulse sensor on an earring clipped to one of the lobes. When the sensor detects an exaltation in pulse servos on both sides of the glasses will close the curtains covering both eyes. The arduino board and two demo buttons are housed in a small plastic box that fits in your pocket.

    (More …)

     
  • aisencc 11:18 pm on December 22, 2011 Permalink | Reply  

    Searching for the Right Channel 2 

    This is the improved version of the toy searching for the right channel. This is a clever way for optimizing the amount of animations a lol shield can exhibit, by making some of the led points switches. I painted it white because it matched the Mac remote I was using. Also, I added 3 other animations, CNN, a porn channel, the previous Discovery, and an alien channel. I failed to find the alien channel myself falling as a victim of my own architecture!

    Enjoy!

     
  • aisencc 10:18 am on December 5, 2011 Permalink | Reply  

    Grove Sound Recorder: PLAY/REC Switching from Manual to Digital 

    While trying to decipher how to bypass a manual switch with a digital gate, I found transistors to be helpful, but for the sound recorder itself.
    First I tried to switch an LED on/off. Here is a photo of the LED circuit.
    Then I tried to replace the play/ record switch in the sound recorder with two transistors, with this schematic:
    But I had no luck!
    This was the code I used:
    You will need the library 
     
    • Catalina Cortazar 9:10 pm on December 7, 2011 Permalink | Reply

      gracias Aisen!!!

  • aisencc 4:08 pm on December 2, 2011 Permalink | Reply  

    Searching for the Right Channel 

    This project was created using the LOL Shield by Jimmie Rodgers and the IR library by Ken Shirriff. The LOL library and the IR library do not work together because the ISR code in both is using the same timer. I tried combining both libraries and make one of the  ISR a separate function and injected into the other, however; it failed, so I had to alter the example code of the LOL Shield without the library and the help of my friend Shawn Lauriat. The idea the came to fruition, using the mac remote I was able to move a dot around the screen. Then if you found the right dot an animation would appear that I coded in with the help of Jimmie Rodgers’s excel sheet. Then the play button would flash all the LEDs at once and the menu button would reset your dot position. Its aesthetic is like a cute TV or a Bomb!

    Searching for the Right Channel

     
    • aisencc 5:54 am on December 6, 2011 Permalink | Reply

      // Searching for the Right Channel
      // By Aisen Caro Chacin
      // With the help of Shawn Lauriat, the LOL shield and IR library developers

      #include //This is in the Arduino library
      #include // IR remote control library

      const int irReceivePin = 14; // pin connected to IR detector output
      IRrecv irrecv(irReceivePin); // create the IR library
      decode_results results; // IR data goes here

      int blinkdelay = 75; //This basically controls brightness. Lower is dimmer
      int runspeed = 20; //smaller = faster

      int pin13 =13;
      int pin12 =12;
      int pin11 =11;
      int pin10 =10;
      int pin09 =9;
      int pin08 =8;
      int pin07 =7;
      int pin06 =6;
      int pin05 =5;
      int pin04 =4;
      int pin03 =3;
      int pin02 =2;

      int x=1;
      int y=0;

      const int pins[] = {
      pin13,pin12,pin11,pin10,pin09,pin08,pin07,pin06,pin05,pin04,pin03,pin02};

      const int ledMap[126][2] ={
      {pin13, pin05},{pin13, pin06},{pin13, pin07},{pin13, pin08},{pin13, pin09},{pin13, pin10},{pin13, pin11},{pin13, pin12},{pin13, pin04},{pin04, pin13},{pin13, pin03},{pin03, pin13},{pin13, pin02},{pin02, pin13},
      {pin12, pin05},{pin12, pin06},{pin12, pin07},{pin12, pin08},{pin12, pin09},{pin12, pin10},{pin12, pin11},{pin12, pin13},{pin12, pin04},{pin04, pin12},{pin12, pin03},{pin03, pin12},{pin12, pin02},{pin02, pin12},
      {pin11, pin05},{pin11, pin06},{pin11, pin07},{pin11, pin08},{pin11, pin09},{pin11, pin10},{pin11, pin12},{pin11, pin13},{pin11, pin04},{pin04, pin11},{pin11, pin03},{pin03, pin11},{pin11, pin02},{pin02, pin11},
      {pin10, pin05},{pin10, pin06},{pin10, pin07},{pin10, pin08},{pin10, pin09},{pin10, pin11},{pin10, pin12},{pin10, pin13},{pin10, pin04},{pin04, pin10},{pin10, pin03},{pin03, pin10},{pin10, pin02},{pin02, pin10},
      {pin09, pin05},{pin09, pin06},{pin09, pin07},{pin09, pin08},{pin09, pin10},{pin09, pin11},{pin09, pin12},{pin09, pin13},{pin09, pin04},{pin04, pin09},{pin09, pin03},{pin03, pin09},{pin09, pin02},{pin02, pin09},
      {pin08, pin05},{pin08, pin06},{pin08, pin07},{pin08, pin09},{pin08, pin10},{pin08, pin11},{pin08, pin12},{pin08, pin13},{pin08, pin04},{pin04, pin08},{pin08, pin03},{pin03, pin08},{pin08, pin02},{pin02, pin08},
      {pin07, pin05},{pin07, pin06},{pin07, pin08},{pin07, pin09},{pin07, pin10},{pin07, pin11},{pin07, pin12},{pin07, pin13},{pin07, pin04},{pin04, pin07},{pin07, pin03},{pin03, pin07},{pin07, pin02},{pin02, pin07},
      {pin06, pin05},{pin06, pin07},{pin06, pin08},{pin06, pin09},{pin06, pin10},{pin06, pin11},{pin06, pin12},{pin06, pin13},{pin06, pin04},{pin04, pin06},{pin06, pin03},{pin03, pin06},{pin06, pin02},{pin02, pin06},
      {pin05, pin06},{pin05, pin07},{pin05, pin08},{pin05, pin09},{pin05, pin10},{pin05, pin11},{pin05, pin12},{pin05, pin13},{pin05, pin04},{pin04, pin05},{pin05, pin03},{pin03, pin05},{pin05, pin02},{pin02, pin05}
      };

      uint16_t BitMap[][9] PROGMEM = {
      {0,0,0,0,2048,5120,2048,0,0},
      {0,0,0,10752,2048,13824,2048,10752,0},
      {0,13696,8320,2560,13696,2560,8320,13696,0},
      {4352,9344,2624,4352,9344,2560,9408,12672,6912},
      {4352,9344,2624,4352,8320,15232,8384,12672,6912 },
      {1024,1536,1280,1152,1088,16352,4224,3840,0},
      {1024,1536,17921920,1024,16320,4224,3860,16383},
      {1024,1536,1792,1920,1024,16320,4224,3882,16383},
      {512,768,896,960,512,8160,2112,6037,16383},
      {256,384,448,480,256,4080,1056,5098,16383},
      {128,192,224,240,128,2040,528,4586,16383},
      {64,96,112,120,64,1020,8456,13562,16383},
      {32,48,56,60,32,8702,12420,14457,16383},
      {32,48,56,60,8224,12798,14468,15482,16383},
      {16,24,8220,30,12304,14591,15426,15934,16383},
      {8,8204,12302,8207,8200,15487,15905,16286,16383},
      {4,1229,14343,8199,8196,12351,15888,16271,16383},
      {2,6147,15363,12291,12290,14367,16136,16327,16383},
      {1,7169,15873,14849,14337,15375,15876,16355,16383},
      {0,7680,16128,14592,14336,14343,15362,16129,16383},
      {16128,16256,16320,14528,12352,12291,12289,14336,16383},
      {7680,16256,16320,16352,15456,14369,14336,14336,16383},
      {1920,8128,16352,16352,15920,15520,15456,15872,16383},
      {0,1984,4064,7952,15952,16016,15968,16128,16383},
      {0,448,2016,4080,7952,16208,16160,16256,16383},
      {0,0,960,2016,3984,7984,16256,16376,16383},
      {0,0,0,960,1824,4000,8128,16380,16383},
      {0,0,0,384,960,2016,4088,16382,16383},
      {0,0,0,192,480,1008,2040,16383,16383},
      {0,0,0,0,192,480,1008,2040,16383},
      {0,0,0,192,0,192,480,1008,2040},
      {0,0,192,0,0,192,480,1008,2040},
      {0,288,0,192,0,192,480,1008,2040},
      {0,816,192,0,0,192,480,1008,2040},
      {0,816,1032,192,0,192,480,1008,2040},
      {0,816,1032,192,0,192,480,1008,2040},
      {0,528,1224,1032,0,192,480,1008,2040},
      {0,560,1032,1032,528,192,480,1008,2040},
      {0,560,1224,1032,528,480,480,1008,2040},
      {0,560,1224,1032,528,288,480,1008,2040},
      {0,560,1224,1032,528,288,192,1008,2040},
      {0,560,2040,1752,528,816,480,192,0},
      {0,560,1224,1032,0,528,288,192,0},
      {0,560,1224,1032,4092,528,288,192,0},
      {0,560,2040,1752,4092,816,0,0,0},
      {0,512,1920,1728,3968,768,0,0,0},
      {1792,3712,4032,7872,8064,3968,1792,0,8},
      {0,1536,1984,1664,3968,768,0,8,28},
      {0,1536,3968,3840,7424,1536,8,28,28},
      {0,1536,3968,3840,7424,1544,28,28,28},
      {0,1536,3968,3840,7448,1564,28,28,62},
      {0,1536,3968,3848,7452,1564,28,62,127},
      {0,1536,3976,3868,7452,1564,62,127,93},
      {0,1544,3996,3868,7452,1598,127,93,8},
      {0,1032,3612,3612,1052,62,127,93,8},
      {4096,14336,4192,192,2018,4095,2034,192,96},
      {4096,14336,4288,384,4066,8183,4066,384,192},
      {10240,4096,11264,6144,15873,16251,15889,6144,3072},
      {4096,14336,6144,12288,15364,16094,15364,12288,6144},
      {10240,4096,14336,8192,14340,16094,14340,8192,12288},
      {0,4096,8192,0,12292,15070,12292,0,8192},
      {4096,14336,4096,0,8196,14046,8196,0,0},
      {4096,14336,4096,0,66,11759,66,0,0},
      {0,0,0,0,0,11759,0,0,0},
      {18000}
      };

      // BitMap[9]
      uint16_t grid[] = {
      0, 0, 0, 0, 0, 0, 0, 0, 0
      };

      void up(){
      Serial.println(“moveUP();”);

      if(y > 0){
      y= y -1;
      }
      }

      void down(){
      Serial.println(“moveDOWN();”);
      if(y < 8){
      y= y +1;
      }
      }

      void right(){
      Serial.println("moveRIGHT();");
      if(x 1) {
      x /= 2;
      }
      }

      void menu(){
      Serial.println(“menu();”);
      x=1;
      y= 0;
      }

      void play(){
      Serial.println(“play();”);
      blinkall(33);
      }

      void setup() {
      blinkall(2); // useful for testing
      Serial.begin(9600);
      pinMode(irReceivePin, INPUT);
      irrecv.enableIRIn(); // Start the IR receiver
      Serial.println(“Press a remote key”);
      }

      void turnon(int led) {
      int pospin = ledMap[led][0];
      int negpin = ledMap[led][1];
      pinMode (pospin, OUTPUT);
      pinMode (negpin, OUTPUT);
      digitalWrite (pospin, HIGH);
      digitalWrite (negpin, LOW);
      }

      void alloff() {
      DDRD = B00000010;
      DDRB = B00000000;
      }

      void loop() {
      byte line = 0;
      unsigned long data;
      if (irrecv.decode(&results)) {
      // here if data is received
      irrecv.resume();
      if(results.value == 2011255018){
      up();
      }else if(results.value == 2011246826){
      down();
      }else if(results.value == 2011259114){
      right();
      }else if(results.value == 2011271402){
      left();
      }else if(results.value == 2011283690){
      menu();
      }else if(results.value == 2011275498){
      play();
      }
      }
      if (x == 2048 && y == 5) {
      DisplayBitMap();
      y = 0;
      }
      for(line = 0; line < 9; line++){
      if(line == y){
      grid[line]= x;
      }else{
      grid[line]= 0;
      }
      }
      for(int i = 0; i < runspeed; i++) {
      for(line = 0; line < 9; line++) {
      data= grid[line];
      for (byte led=0; led<14; ++led) {
      if (data & (1<<led)) {
      turnon((line*14)+led);
      delayMicroseconds(blinkdelay);
      alloff();
      }
      else {
      delayMicroseconds(blinkdelay);
      }
      }
      }
      }
      }

      void blinkall(int numblink) {
      alloff();
      for(int n = 0;n < numblink;n++) {
      if (irrecv.decode(&results)) { // need to call the IR read
      // here if data is received
      irrecv.resume();
      if(results.value == 2011283690){ // this makes the menu button reset if it is stuck on the play loop
      return;
      }
      }
      for(int i = 0; i < runspeed; i++) {
      for(int j = 0; j < 126; j++) {
      turnon(j);
      delayMicroseconds(blinkdelay);
      alloff();
      }
      }
      delay(500);
      }
      }

      void sequenceon() {
      for(int i = 0; i < 126; i++) {
      turnon(i);
      delay(800);
      alloff();
      delay(800);
      }
      }

      void DisplayBitMap()
      {
      boolean run=true;
      byte frame = 0;
      byte line = 0;
      unsigned long data;
      while(run == true) {
      for(int i = 0; i < runspeed; i++) {
      for(line = 0; line < 9; line++) {
      data = pgm_read_word_near (&BitMap[frame][line]); // fetch data from program memory
      if (data==18000){
      run=false;
      }
      else for (byte led=0; led<14; ++led) {
      if (data & (1<<led)) {
      turnon((line*14)+led);
      delayMicroseconds(blinkdelay);
      alloff();
      }
      else {
      delayMicroseconds(blinkdelay);
      }
      }

      }

      } frame++;
      }
      }

  • aisencc 4:03 am on November 9, 2011 Permalink | Reply  

    Toccata CalaBach 


    The concept behind this pumpkin was inspired by the Toccata in Fugue D Minor by Bach. The teeth of the pumpkin are white keys/ switches, that when pressed to the bottom surface close the circuit and play a note through a piezo buzzer. If the first and the last key are both pressed at the same time, a short introduction of the Toccata in Fugue plays. The light of the pumpkin turns on at night, once a photoresistor reads values that are low enough to mean darkness. A little stuffed dead guy accompanies Toccata CalaBach, representing Johann Sebastian.

     

    // CODE:

    int photo= 0;
    int led = 2;
    int key1 = 3;
    int key2 = 4;
    int key3 = 5;
    int key4 = 6;
    int key5 = 7;
    int key6 = 8;
    int speakerOut = 9;

    int debounce = 10;

    int state= LOW;
    int lastkeyvalue = LOW; // we start, assuming no motion detected
    int val= 0;
    int val1 = 0;
    int val2 = 0;
    int val3 = 0;
    int val4 = 0;
    int val5 = 0;
    int val6 = 0;
    // variable for reading the key status
    //******************************************************************************
    // TONES ==========================================
    // Start by defining the relationship between
    // note, period, & frequency.
    int c= 3830; // 261 Hz
    int d= 3400; // 294 Hz
    int e= 3038; // 329 Hz
    int f= 2864; // 349 Hz
    int g= 2550; // 392 Hz
    int a= 2272; // 440 Hz
    int b= 2028; // 493 Hz
    int C= 1912; // 523 Hz
    // Define a special note, ‘R’, to represent a rest
    int O= 0;

    // MELODY and TIMING =======================================
    // melody[] is an array of notes, accompanied by beats[],
    // which sets each note’s relative length (higher #, longer note)
    int melody[] = {
    a, g, a, O, g, f, e, d, 3615, d };
    int beats[] = {
    8, 8, 64, 64, 16, 16, 16, 16, 64, 64 };
    int MAX_COUNT = sizeof(melody) / 2; // Melody length, for looping.

    // Set overall tempo
    long tempo = 10000;
    // Set length of pause between notes
    int pause = 1000;
    // Loop variable to increase Rest length
    int rest_count = 100; //<-BLETCHEROUS HACK; See NOTES

    // Initialize core variables
    int tone_ = 0;
    int beat = 0;
    long duration = 0;
    //******************************************************************************

    void setup() {
    pinMode(speakerOut, OUTPUT);
    pinMode(photo, INPUT); //photoresistor Analog
    pinMode(key1, INPUT);
    pinMode(key2, INPUT);
    pinMode(key3, INPUT);
    pinMode(key4, INPUT);
    pinMode(key5, INPUT);
    pinMode(key6, INPUT);
    pinMode(led, OUTPUT);

    Serial.begin(9600);
    }

    void loop(){
    val1 = digitalRead(key1);
    val2 = digitalRead(key2);
    val3 = digitalRead(key3);
    val4 = digitalRead(key4);
    val5 = digitalRead(key5);
    val6 = digitalRead(key6);
    if (val1 == HIGH && val6 == HIGH){
    playSong();
    }else{
    keyTones();
    }
    nightLight();

    }

    void keyTones(){
    Serial.println(“val1″);
    if (val1 == HIGH){
    tone_=c;
    duration= 640000;
    playTone();
    Serial.println(“YES = 1″);
    }
    if (val2 == HIGH){
    tone_=d;
    duration= 640000;
    playTone();
    Serial.println(“YES = 2″);
    }
    if (val3 == HIGH){
    tone_=e;
    duration= 640000;
    playTone();
    Serial.println(“YES = 3″);
    }

    if (val4 == HIGH){
    tone_=f;
    duration= 640000;
    playTone();
    Serial.println(“YES = 4″);
    }
    if (val5 == HIGH){
    tone_=g;
    duration= 640000;
    playTone();
    Serial.println(“YES = 5″);
    }
    if (val6 == HIGH){
    tone_=a;
    duration= 640000;
    playTone();
    Serial.println(“YES = 6″);
    }
    else {
    digitalWrite(speakerOut, LOW);
    }
    if (val1 != lastkeyvalue ){
    delay(debounce);
    val1 = key1;
    }
    lastkeyvalue= val1, val2, val3, val4, val5, val6;

    }

    void nightLight(){
    val= analogRead(photo);
    // Serial.print(val);
    Serial.print(10, BYTE);
    delay(10);

    if (val<400){
    digitalWrite(led, HIGH);
    }else{
    digitalWrite(led, LOW);
    }

    }

    void playSong() {
    // Set up a counter to pull from melody[] and beats[]
    for (int i=0; i 0) { // if this isn’t a Rest beat, while the tone has
    // played less long than ‘duration’, pulse speaker HIGH and LOW
    while (elapsed_time < duration) {

    digitalWrite(speakerOut,HIGH);
    delayMicroseconds(tone_ / 2);

    // DOWN
    digitalWrite(speakerOut, LOW);
    delayMicroseconds(tone_ / 2);

    // Keep track of how long we pulsed
    elapsed_time += (tone_);
    }
    }
    else { // Rest beat; loop times delay
    for (int j = 0; j < rest_count; j++) { // See NOTE on rest_count
    delayMicroseconds(duration);
    }
    }
    }

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel
Follow

Get every new post delivered to your Inbox.