Introduction: Froggy World a 3D Printing Project
Step 1:
Here's the code:
#include <Servo.h>
Servo gate;
Servo bird;
int start=10;
int next=7;
int dummy=0;
int train=5;
int arrival=1;
int val=0;
int val2=0;
int birdin=9;
int birdout=8;
int birdmagnet=4;
int val3=5;
void setup()
{gate.attach (3);
bird.attach (2);
pinMode (next, OUTPUT);
pinMode (start, INPUT);
pinMode(arrival, INPUT);
pinMode (train, OUTPUT);
pinMode(birdin, INPUT);
pinMode(birdout, OUTPUT);
pinMode(birdmagnet, INPUT);
digitalWrite (next, HIGH);
digitalWrite (train, LOW);
digitalWrite (birdout, HIGH);
gate.write(130);
bird.write(170);
delay(1000);
}
void loop()
{val=digitalRead(start);
if(val==LOW or dummy==1)
{
gate.write(45);
bird.write(85);
delay (500);
digitalWrite(train,HIGH);
//if(dummy=0)
delay(5000);
dummy=2;}
else
{val2=digitalRead(birdmagnet);
if(val2==LOW)
{delay(1025);//delay from magnet to bird gate
digitalWrite (train, LOW);
bird.write(165);
val2=0;
dummy=0;
val=0;
delay(500);
digitalWrite (birdout, LOW);//start bird pickup
delay (500);
digitalWrite (birdout, HIGH);}
else
{val3=digitalRead(birdin);
if(val3==LOW or dummy==5)//signal that bird is done
{
gate.write(45);
bird.write(85);
digitalWrite(train,HIGH);
dummy=5;
val2=digitalRead(arrival);
if(val2==LOW)
//{delay(100);//delay from magnet to main gate
{digitalWrite (train, LOW);
gate.write(130);
val2=0;
dummy=0;
val=0;
digitalWrite (next, LOW);
delay (500);
digitalWrite (next, HIGH);
}}}}}
Step 2:
3D design and print files are available at:
http://www.thingiverse.com/thing:70140
Step 3:
Step 4:
Step 5:
Step 6:
Step 7:
Thanks for stopping by Froggy World :)