17 February 2026

Cat Paw

SVG File

 This work is called Cat Paw. The main intention of this was to create a cute motorized cat that moves its paw up and down. Referencing the beckoning cat, this project uses a motor along with a joystick to control the paw. Along with the cat is a fish that can easily get knocked down. The story is of a playful cat messing aggressively with a fish. 





//cat code
#define ENABLE 5
#define DIRA 3
#define DIRB 4
int joyStickPin = A0;
int drift = 20;
int i;
 
void setup() {
  //---set pin direction
  pinMode(ENABLE,OUTPUT);
  pinMode(DIRA,OUTPUT);
  pinMode(DIRB,OUTPUT);
  pinMode (joyStickPin, INPUT_PULLUP);
  Serial.begin(9600);
}
void loop() {
  //first get the up or down of the joy stick  between 1023 and 0 and then remap it to ... -255 to 255 for the motor if it's 0 - 255 it's down paw, if it's -255 through 0 it's up paw

  int inputY = MapValues(); //get a return value that will determine if up or down and how fast up or down
  Serial.println(inputY);

  if(inputY > drift){
    analogWrite(ENABLE,abs(inputY)); // enable amount
    digitalWrite(DIRA,HIGH); //down paw
    digitalWrite(DIRB,LOW);
     //delay(50);
  }
  else if(inputY <= drift && inputY >= -drift ){
    digitalWrite(ENABLE, LOW); //paw off, might need some fall off
    // delay(50);
 
  }
  else if (inputY < -drift ){
    analogWrite(ENABLE,abs(inputY)); // enable amount
    digitalWrite(DIRA,LOW);  //up paw
    digitalWrite(DIRB,HIGH);
     //delay(50);
  }
   
  }

  int MapValues(){
Serial.println(analogRead(joyStickPin));
  int mapStick = map(analogRead(joyStickPin), 0, 1023, -200, 200);
      Serial.println("Mapped Input: ");


  return mapStick;

}










No comments:

Post a Comment

Note: Only a member of this blog may post a comment.