My final project is the first in a set of robots that ignore you.
This one, uses a sound sensor to tell if you are talking, and when it hears you, it covers its ears with its hand. The other one shuts its eyes when it sees you, and the final one turns its head away from you.
This is a still of the project:
This is a video & circuit view:
(me snapping in order to activate)
* Rui Santos
* Complete Project Details http://randomnerdtutorials.com
*
*
* by BARRAGAN <http://barraganstudio.com>
This example code is in the public domain.
modified 8 Nov 2013
by Scott Fitzgerald
http://www.arduino.cc/en/Tutorial/Sweep
*/
#include Servo.h;
Servo handMovement;
int pos = 0;
int sensorPin=10;
boolean val =0;
void handsUp(){
for (pos = 0; pos <= 90; pos += 1) {
// in steps of 1 degree
handMovement.write(pos);
delay(15);
}
}
void handsDown(){
for (pos = 90; pos >= 0; pos -= 1) {
handMovement.write(pos);
delay(15);
}
}
void setup(){
pinMode(sensorPin, INPUT);
handMovement.attach(9);
Serial.begin (9600);
handMovement.write(0);
handsUp();
}
void loop (){
val =digitalRead(sensorPin);
Serial.println (val);
// when the sensor detects a signal above the threshold value, he hears you!! hands up
if (val==HIGH) {
handsUp();
}
else {
handsDown(); }
}
Here is the fritz: