King Simba

Helping Ricky de-stress and reflect on his life through physical and visual interactions

Showcase (no instructions)373
King Simba

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×2
ISD1820 Voice Record Module
×1
RGB LED
×1
Tactile Switch
×2
Speaker
×1
9V battery (generic)
9V battery (generic)
×1
9V Battery Holder Box w/ Slide Switch
×1

Hand tools and fabrication machines

Scissors
Soldering iron (generic)
Soldering iron (generic)
Laser cutter (generic)
Laser cutter (generic)
Needle and Thread

Story

Read more

Code

Internal Arduino Loop

C/C++
This is the code which runs the lion's interactions. Controls sound and lights via button inputs.
#define PLAYE 2
//This is to play sound

int redPin = 11; int greenPin = 10; int bluePin = 9; int BUT = 4;
int red = 255; int green = 0; int blue = 0; bool PULSING = 0;
//setup of the rgb led

void setup() {
pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT); pinMode(BUT,INPUT);
setColor(red, green, blue);  
}
void loop() {

   if (PULSING == 0){
   //check if in the pulsing state
  
  if (digitalRead(BUT) == HIGH){
    //check for button input
    if (red < 10){
      //if we have a red threshold met, set equal to zero
      //initialize the sound and set pulsing state to TRUE
       red = 0;
       PULSING = 1;
       digitalWrite(PLAYE,1);    
       
    } else{
        red = red - 8;   
        green = green + 8;
        delay(100);   
        setColor(red, green, blue);
    }

} else{
  //analogWrite(redPin, LOW);
}
   } else {
    int i;
    for (i = 0; i < 10; i = i +1){
      
    
  float in, out;
  for (in = 0; in < 6.283; in = in + 0.001)
  {
    out = sin(in) * 127.5 + 127.5;
    //Sinusoidal pulsing for lion's heart
    analogWrite(redPin,out);
  }
   
   delay(100);
   }
  
  PULSING=0;
  //adter the loop we reinitialize variables to original state 
  red = 255;
  green = 0;
  setColor(red, green, blue);  
   }



}

void setColor(int red, int green, int blue) {
analogWrite(redPin, red); analogWrite(greenPin, green); analogWrite(bluePin, blue);
}

Credits

Baxter Smith

Baxter Smith

9 projects • 7 followers
Architecture Masters student in second of three year program, I enjoy working with physical models and would like to work more with arduino based models
Jessie Salas

Jessie Salas

3 projects • 1 follower
Machine learning and NLP
Shannon Chu

Shannon Chu

3 projects • 0 followers
Hasnain Nazar

Hasnain Nazar

3 projects • 1 follower
Stacey Baradit

Stacey Baradit

3 projects • 1 follower
NOTHING

Comments