Project showcase
Cool Baby Piano

Cool Baby Piano © GPL3+

Did you ever want to strengthen your child's motor skills while showing the tones of sound and color? This project does the trick!

  • 1,072 views
  • 0 comments
  • 1 respect

Components and supplies

About this project

Alek and I are doing a project in our Physical Computing class at Lane Tech. Our objective was to make a children's toy that was interactive, and we had to use a at least 2 things similar to potentiometers which is why we used a soft potentiometer and a flex sensor.

Code

Baby ProjectJava
This is the code that starts up the toy.
bool redIsOn = false;
bool blueIsOn = false;
bool greenIsOn = false;
bool yellowIsOn = false;
bool startUpHappened = false;

void setup() {
  
  pinMode(13, OUTPUT);
  pinMode(12, INPUT_PULLUP);
  pinMode(11, OUTPUT);
  pinMode(10, INPUT_PULLUP);
  pinMode(9, OUTPUT);
  pinMode(8, INPUT_PULLUP);
  pinMode(7, OUTPUT);
  pinMode(6, INPUT_PULLUP);
  pinMode(5, INPUT_PULLUP);
  pinMode(4, OUTPUT);
  
}

void loop() {
  
  if (digitalRead(5) == 0) {
    
    if (startUpHappened == false) {
      
      //left
      digitalWrite(7, HIGH);
      delay(150);
      
      digitalWrite(7, LOW);
      digitalWrite(9, HIGH);
      delay(150);
      
      digitalWrite(9, LOW);
      digitalWrite(11, HIGH);
      delay(150);
      
      digitalWrite(11, LOW);
      digitalWrite(13, HIGH);
      delay(150);
      
      digitalWrite(13, LOW);
      //right
      digitalWrite(11, HIGH);
      delay(150);
      
      digitalWrite(11, LOW);
      digitalWrite(9, HIGH);
      delay(150);
      
      digitalWrite(9, LOW);
      digitalWrite(7, HIGH);
      delay(150);
      
      digitalWrite(7, LOW);
      delay(150);
      
      startUpHappened = true;
      
    }
    
    if (digitalRead(12) == 0) {
      
      if (redIsOn == false) {
        
        digitalWrite(11, LOW);
        blueIsOn = false;
        
        digitalWrite(9, LOW);
        greenIsOn = false;
        
        digitalWrite(7, LOW);
        yellowIsOn = false;
        
        digitalWrite(13, HIGH);
        redIsOn = true;
        
        digitalWrite(4, HIGH);
        tone(4, 2500);
        
        delay(500);
        
      } else {
        
        digitalWrite(13, LOW);
        redIsOn = false;
        
        noTone(4);
        delay(500);

      }
      
    }
    
    if (digitalRead(10) == 0) {
      
      if (blueIsOn == false) {
        
        digitalWrite(13, LOW);
        redIsOn = false;
        
        digitalWrite(9, LOW);
        greenIsOn = false;
        
        digitalWrite(7, LOW);
        yellowIsOn = false;
        
        digitalWrite(11, HIGH);
        blueIsOn = true;
        
        digitalWrite(4, HIGH);
        tone(4, 2833);

        delay(500);
        
      } else {
        
        digitalWrite(11, LOW);
        blueIsOn = false;
        
        noTone(4);
        delay(500);
        
      }
      
    }
    
    if (digitalRead(8) == 0) {
      
      if (greenIsOn == false) {
        
        digitalWrite(13, LOW);
        redIsOn = false;
        
        digitalWrite(11, LOW);
        blueIsOn = false;
        
        digitalWrite(7, LOW);
        yellowIsOn = false;
        
        digitalWrite(9, HIGH);
        greenIsOn = true;
        
        digitalWrite(4, HIGH);
        tone(4, 3167);

        delay(500);
        
      } else {
        
        digitalWrite(9, LOW);
        greenIsOn = false;
        
        noTone(4);
        delay(500);
        
      }
      
    }
    
    if (digitalRead(6) == 0) {
      
      if (yellowIsOn == false) {
        
        digitalWrite(13, LOW);
        redIsOn = false;
        
        digitalWrite(11, LOW);
        blueIsOn = false;
        
        digitalWrite(9, LOW);
        greenIsOn = false;
        
        digitalWrite(7, HIGH);
        yellowIsOn = true;
        
        digitalWrite(4, HIGH);
        tone(4, 3500);

        delay(500);
        
      } else {
        
        digitalWrite(7, LOW);
        yellowIsOn = false;
        
        noTone(4);
        delay(500);
        
      }
      
    }
    
  } else {
    
    digitalWrite(13, LOW);
    redIsOn = false;
    
    digitalWrite(11, LOW);
    blueIsOn = false;
    
    digitalWrite(9, LOW);
    greenIsOn = false;
    
    digitalWrite(7, LOW);
    yellowIsOn = false;

    noTone(4);
    digitalWrite(4, LOW);
    
    startUpHappened = false;
    
  }
  
}

Schematics

Baby Project
code for Project
baby_project1_COcymoq9by.ino
Baby Project
Circuit board
baby_project_wQ4plJL42z.brd
Baby Project
Picture of circuit board
Baby project cl1jxblmpx

Comments

Similar projects you might like

Arduino Tutorial : Mini Piano

Project tutorial by the lonely programmer

  • 6,280 views
  • 2 comments
  • 8 respects

Electronic Piano Keyboard With Preset Songs

Project tutorial by Lindsay Fox

  • 77,988 views
  • 60 comments
  • 150 respects

Arduino Piano

Project in progress by Teo Zhi Yi

  • 2,570 views
  • 0 comments
  • 7 respects

Unravel Preset Piano Easy Arduino (Even a Ghoul Can Make It)

Project in progress by ExeCuteLi

  • 5,485 views
  • 8 comments
  • 20 respects

PIANO

Project tutorial by يمنى السيد ندا

  • 3,496 views
  • 0 comments
  • 2 respects

Automatic Baby Rocker!

Project showcase by SindreKragsrud

  • 996 views
  • 0 comments
  • 7 respects
Add projectSign up / Login