loading


Wex detects your location with ultrasonic sensors then follows you with his one flashing eye.  His red "heartbeat" can be seen through his mouth.

Step 1:

Parts needed include:

Arduino
Two ping ultrasonic sensors
Futaba s3103 servo
Radio Shack 276-0016 7 color led
Radio Shack  276-036 flashing red led
9 volt battery
480 ohm resistor
680 ohm resistor
Metal duct tape
Super glue
Case (print 3d parts--use a printing service to print them--make your own case)
http://www.thingiverse.com/thing:32121

The software "looks to the left--turn left if something there"
       "look to the right--turn right if something there"
       "look straight if nothing to the left or right"

#include <Servo.h>

Servo myservo;
const int pingPin = 7;
const int pingPin2 = 9;
long duration;
long duration1;


void setup ()
{myservo.attach(5);
}
void loop ()
{
  pinMode (pingPin, OUTPUT);
  digitalWrite (pingPin, LOW);
  delayMicroseconds (2);
  digitalWrite (pingPin, HIGH);
  delayMicroseconds (5);
  digitalWrite (pingPin, LOW);
  pinMode (pingPin, INPUT);
  duration = pulseIn (pingPin, HIGH);
  if (duration <5000)
  {
  myservo.write(125);
  delay(500);
  }
 
 
 // else
  {
    pinMode (pingPin2, OUTPUT);
  digitalWrite (pingPin2, LOW);
  delayMicroseconds (2);
  digitalWrite (pingPin2, HIGH);
  delayMicroseconds (5);
  digitalWrite (pingPin2, LOW);
  pinMode (pingPin2, INPUT);
  duration1 = pulseIn (pingPin2, HIGH);
  if (duration1 <5000)
  {
  myservo.write(5);
  delay(500);
  }
  if (duration >5000 and duration1 >5000)
 
 

  {myservo.write(65);
  delay(500);
  }}}
 
 
cool project, very life-like! I especially like the 3d printed feet. what did you print this on? do you have any tips to avoid shrinkage cracking on such a large enclosure?
I printed with a MakerBot Replicator. Set a platform temperature of 110 degrees and close off the sides and front of the machine to prevent drafts (and reduce cracks). I only had the sides closed (paper taped over sides) and the open front may have contributed to the cracks. At 6 hours per print, I wasn't ready to retry on this particular piece :)

About This Instructable

1,167 views

7 favorites

License:

Bio: My book, A BEGINNERS GUIDE TO 3D PRINTING: 14 SIMPLE TOY DESIGNS TO GET YOU STARTED is now available. If you want to design your ... More »
More by MikeTheMaker: Magnetic Powered Skateboard Figure--Christmas Display 2016 Cardboard Ferris Wheel Servo Controlled Clapping Monkey--Christmas Display 2016
Tags: Arduino Ping
Add instructable to: