Ashraf Nabil
Published © Beerware

Automated Photo Booth using Arduino and 1Sheeld

Automated Photo Booth takes a picture and posts it on Twitter with Arduino and 1Sheeld at Cairo Mini Maker Faire

Work in progress6,864
Automated Photo Booth using Arduino and 1Sheeld

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
1Sheeld
1Sheeld
×1
PVC pipes and PVC elbow angles
×1
Relay Board
×1
Ultrasonic Sensor
×1
AC Lamp
×1
Cable ties
×1

Software apps and online services

Twitter
Twitter

Story

Read more

Code

Untitled

C/C++
/* Include 1Sheeld library. */
#include <OneSheeld.h>
const int trigPin = 2;
const int echoPin = 4;
const int ledPin = 13;
void setup() {
  /* Start communication. */
  OneSheeld.begin();
  pinMode(ledPin, OUTPUT);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
}
void loop()
{
  long duration, cm; 
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
 // convert the time into a distance
 cm = microsecondsToCentimeters(duration);
  if(cm <= 40){
    digitalWrite(ledPin, HIGH);   // turn the LED on (HIGH is the voltage level)
    delay(1000);               // wait for a second
    digitalWrite(ledPin, LOW);    // turn the LED off by making the voltage LOW
    delay(1000);
    digitalWrite(ledPin, HIGH);   // turn the LED on (HIGH is the voltage level)
    delay(1000);
    digitalWrite(ledPin, LOW);    // turn the LED off by making the voltage LOW
    delay(1000);
    digitalWrite(ledPin, HIGH);   // turn the LED on (HIGH is the voltage level)
    delay(1000);               // wait for a second
    digitalWrite(ledPin, LOW);    // turn the LED off by making the voltage LOW
    delay(1000);   
    Camera.setFlash(ON);
    /* Take the picture. */
    Camera.rearCapture();
    /* Wait for 10 seconds. */
    delay(10000);
    /* Post the picture on Twitter. */
    Twitter.tweetLastPicture("We are having fun at Cairo mini #makerfaire, photo taken by @Arduino and @1Sheeld!");    
  }
delay(100);
}
long microsecondsToCentimeters(long microseconds)
{
  return microseconds / 29 / 2;
}

Credits

Ashraf Nabil

Ashraf Nabil

8 projects • 102 followers

Comments