Kitty Coin Striker

by Aleksandra & Carol

Project Image In Action
drawing

The goal was to make electric piggy bank. We got inspired by the kitten pulling the coins into jar, but then building it we gamified it even more, added the gate for the coins to collect.

Arduino Code

int myPhotoresistor = A0;
#include <Servo.h> // include Servo library
Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards
void setup() {
  pinMode(myPhotoresistor, INPUT);
  Serial.begin(9600);
  myservo.attach(8);  // attaches the servo on pin 9 to the servo object
}
void loop() {
   int lightvalue = analogRead(myPhotoresistor);
    if(lightvalue<490) {
  myservo.write(100); //Turn on LED if value us lower then 500
   delay(1000);
  myservo.write(20);
    delay(1000);
  }
Serial.println(lightvalue);
}


© 2023 CC BY-SA 4.0, Görkem Bozkurt. You are free to remix, transform, and build upon the material as long as you distribute your contributions under the same license as the original.