For the assignment to create something that mimics human or animal behavior using motors, I created a cat scratching inside the box.
Below is a video that describes the concept of Schrodinger’s cat in a delightful way.
The code is very simple. I am using a 5V motor and a transistor, so all I had to do was to pass on high voltage for 300 milliseconds then rest for 1 second in a loop.
void setup() {
// put your setup code here, to run once:
pinMode(9, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
//digitalWrite(9, HIGH);
analogWrite(9, 255);
delay(300);
analogWrite(9, 0);
delay(1000);
}