Things used in this project

Hardware components:
Photon new
Particle Photon
×1
09590 01
LED (generic)
×1
Servo (generic)
×1
12002 04
Breadboard (generic)
×2
11026 02
Jumper wires (generic)
×1
Software apps and online services:
Q8wtlimqnp04fzhtr9v5
IFTTT Maker service
Xidmhfnahh6gnduppwzf
Particle Pi
Hand tools and fabrication machines:
Lasercutter
Laser cutter (generic)

Schematics

photo_on_5-22-17_at_1_10_pm_2_cQpOGf5zgc.jpg
Photo on 5 22 17 at 1 10 pm 2 cqpogf5zgc

Code

Untitled fileC/C++
int ledR = D4;
int ledG = D3;
int servoPin = D0;

Servo gumballServo; 

void setup()
{
   gumballServo.attach(servoPin);
   pinMode(ledR, OUTPUT);
   pinMode(ledG, OUTPUT);
   pinMode(servoPin, OUTPUT);

   Particle.function("knock",knockDetector);

   digitalWrite(ledR, LOW);
   digitalWrite(ledG, LOW);
   gumballServo.attach(servoPin);
   gumballServo.write(360);
 }

void loop(){
}

    


int knockDetector(String command){

    if(command=="Knock")
    {
        digitalWrite(ledR,LOW);
        digitalWrite(ledG,HIGH);
        gumballServo.attach(servoPin);
        gumballServo.write(55);
        delay(2000);
        gumballServo.write(360);
        delay(2000);
        gumballServo.detach();
        return 1;
    }
    else if (command=="no")
    {
        digitalWrite(ledR,HIGH);
        digitalWrite(ledG,LOW);
        gumballServo.attach(servoPin);
        gumballServo.write(360);
        delay(1000);
        gumballServo.detach();
        return 0;
    }
    else 
    {
        return -1;
    }
}

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

What's My I2C Address?
Easy
  • 69
  • 3

The story of how to make a clock through using a LCD 1602 or LCD 2004 over I2C.

MyHumidity Controlled by BME280 and Photon
Easy
  • 181
  • 4

Full instructions

Checks if humidity threshold is reached and informs the user by using Blynk/IFTTT-services with softAP integration.

Tweeting Particle Photon
Easy
  • 42
  • 1

Full instructions

Tweet your friends with only the press of a button!

MyLight-Clock with NeoPixel Ring 12 Controlled by Photon
Easy
  • 260
  • 2

Full instructions

Read the time at night? Without glasses? Impossible? Focus on 2 light points, which will tell you the hour and the minute.

Map Your Particles!
Easy
  • 1,354
  • 20

Protip

Locate your Particle Photons, P1s and Electrons on a map without needing extra hardware. Use Ubidots or an offline map alternative

BME280 measures and displays on OLED controlled by Photon
Easy
  • 340
  • 2

Protip

I share my first steps with the sensor BME280 (temp / humi / pressure / altitude) and an OLED 128 * 64 px

Add projectSign up / Login