Meet the Hallowbot
1) Hallowbot
2) The basic idea of my Hallowbot is that communicates with a user. I put a PIR Motion Sensor that detects a user in the room or the area, and greets with waking up with blue leds on the eyes. Then, if a user gets close enough to the Hallowbot, there will be an animation with yellow leds that triggered by a PhotoCell. The yellow animation is similar that talks to a user. Also, I put a Tilt Sensor that triggered by a user touching Hallowbot’s Antena on the top of the head and change the color of a led light to red.
3)
3) A photo of the final project

4) A short video demonstrating it.
5) The code you used.
int inputPin = 2;
int ledPin = 6; // blue led 1
int ledPin4 = 7; // green led 1
// button 2 animation
int inputPin2 = 3;
int ledPin2 = 8; // yellow led 1
int ledPin5 = 9; // yeallow led 2
int ledPin6 = 10; // yellow led 3
int ledPin7 = 11; // yellow led 4
int inputPin3 = 4;
int ledPin3 = 12; // red led
/**** motion sensor *****/
int timer = 500;
int sensorPin = A0;
int sensorValue = 0;
/* photocells */
int photocellPin = A1; // the cell and 10K pulldown are connected to a0
int photocellReading; // the analog reading from the sensor divider
int LEDbrightness; //
void setup(){
Serial.begin(9600);
pinMode(ledPin,OUTPUT);
pinMode(inputPin,INPUT);
pinMode(ledPin2,OUTPUT);
pinMode(inputPin2,INPUT);
pinMode(ledPin3,OUTPUT);
pinMode(inputPin3,INPUT);
// green leds
pinMode(ledPin4, OUTPUT);
// yellow leds
pinMode(ledPin5,OUTPUT);
pinMode(ledPin6,OUTPUT);
pinMode(ledPin7,OUTPUT);
/**** photocells *****/
pinMode(photocellPin, INPUT);
/***** motion sensor *****/
pinMode(sensorPin, INPUT); // A0 analog input
digitalWrite(sensorPin, HIGH); //INTERNAL PULL-UP RESISTOR
delay (2000); // it takes the sensor 2 seconds to scan the area around it before it can detect presence.
}
void loop(){
int val = analogRead(sensorPin);
if (val < 1000){
digitalWrite(ledPin,HIGH);
digitalWrite(ledPin4,LOW);
}
else{
digitalWrite(ledPin,LOW);
digitalWrite(ledPin4,HIGH);
}
delay(timer);
Serial.println (val);
delay (1000);
int val2 = analogRead(photocellPin);
Serial.print("Analog reading for photocell = ");
Serial.println(val2); // the raw analog reading
if(val2 <800)
{
digitalWrite(ledPin3,LOW);
digitalWrite(ledPin4,LOW);
digitalWrite(ledPin,HIGH);
for(int i=0; i<3; i++)
{
digitalWrite(ledPin2, HIGH);
digitalWrite(ledPin5, HIGH);
digitalWrite(ledPin6, HIGH);
digitalWrite(ledPin7, HIGH);
delay(1000);
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, LOW);
digitalWrite(ledPin2, HIGH);
delay(500);
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin5, HIGH);
delay(500);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin5, HIGH);
delay(500);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin6, HIGH);
delay(500);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, HIGH);
delay(500);
digitalWrite(ledPin7, LOW);
digitalWrite(ledPin6, HIGH);
delay(500);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin5, HIGH);
delay(500);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, HIGH);
digitalWrite(ledPin6, HIGH);
digitalWrite(ledPin5, HIGH);
digitalWrite(ledPin2, HIGH);
}
}
//3
int val3 = digitalRead(inputPin);
Serial.print("Analog reading for tilt = ");
Serial.println(val3); // the raw analog reading
if(val3 == HIGH){
// digitalWrite(ledPin,LOW);
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, LOW);
digitalWrite(ledPin3,HIGH);
}
}


Reply