Sad Cat Project

by 958686 in Workshop > 3D Printing

132 Views, 0 Favorites, 0 Comments

Sad Cat Project

Screenshot (196).png
Screenshot (199).png
Screenshot (200).png

This is my Sad Cat Project which I didn't get to build a prototype of, overall this project is supposed to be a glove that features different led lights, has a buzzer and contains multiple songs so your LEDs can be controlled by the sound that is playing... If it is a disco song it the LEDs will be switching fast or you can have a feature where one led will be bright like a laser so you can play with your cat. This was a really fun project, to do, it opened me up to more creativity levels and what each Item can do.

// Programmer: Veer Seehra
// Date Created: January 21 2022

// Program: Sad Cat Project

// Description: Make a sad cat happy

//--------------------------------------------------- //***************************************************

// Global Variables and Constants

//***************************************************

int buzzer = 11;//the pin of the active buzzer

int count=0; //creates a variable integer called 'count'

int newcount; //creates a variable integer called 'newcount'

void setup() {

pinMode(buzzer,OUTPUT);//initialize the buzzer pin as an output

Serial.begin(9600); // use the serial port to print the number

pinMode(5,INPUT); // sets the digital pin 5 as input

pinMode(6,OUTPUT); // sets the digital pin 6 as output

pinMode(7,OUTPUT); // sets the digital pin 7 as output

pinMode(8,OUTPUT); // sets the digital pin 8 as output pinMode(9,OUTPUT); // sets the digital pin 9 as output

} void loop() { unsigned char i; //define a variable

//output an frequency for(int i=0;i<1000;i++) {

digitalWrite(buzzer,HIGH);

delay(1);//wait for 1ms

digitalWrite(buzzer,LOW);

delay(1);//wait for 1ms //output another frequency for(int i=0;i<1000;i++) {

digitalWrite(buzzer,LOW);

delay(2);//wait for 2ms

digitalWrite(buzzer,LOW);

delay(2);//wait for 2ms {

digitalWrite(buzzer,HIGH);

delay(1);//wait for 2ms

digitalWrite(buzzer,LOW);

delay(1);//wait for 2ms

if(digitalRead(5)==HIGH) // Reads the input pin {

newcount=count+1;

if(newcount!=count) {

Serial.println(newcount);

switch (newcount) {

case 1: digitalWrite(6,HIGH); // do something when var equals 1, sets the LED to the button's value break;

case 2: digitalWrite(7,HIGH); // do something when var equals 2, sets the LED to the button's value break;

case 3: digitalWrite(8,HIGH); // do something when var equals 3, sets the LED to the button's value break;

case 4: digitalWrite(9,HIGH); // do something when var equals 4, sets the LED to the button's value break; default: digitalWrite(6,LOW); // // if nothing else matches, do the default, default is optional d

igitalWrite(7,LOW); // sets the LED to the button's value

digitalWrite(8,LOW); // sets the LED to the button's value

digitalWrite(9,LOW); // sets the LED to the button's value

newcount=0; break; }

count=newcount; } } delay(100); // Delay for a millisecond }

} } }