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

E-Paper Weather Display with Photon and IFTTT
Easy
  • 4,154
  • 19

Full instructions

Create a beautiful medium for weather information using Particle's cloud services and IFTTT.

2-Way Particle Photon Communication
Easy
  • 194
  • 4

Make two Particle Photons "talk" via the usage of webhooks!

WiFi Strength Meter
Easy
  • 469
  • 6

A meter that indicates the Wi-Fi signal strength in an intuitive way, using the parts I had on hand.

IFTTT - Enabled Sensors with Particle Photon
Easy
  • 727
  • 12

Full instructions

Connect any sensor to Particle Photon and use it to trigger an IFTTT action with just a few lines of code.

Light Detecting Email Sender
Easy
  • 230
  • 4

Full instructions

Receive an email about when the light is too strong on your device; nobody wants a heated device left directly under the sun. Photon + IFTTT

Internet-Connected Popcorn Popper
Easy
  • 164
  • 1

Full instructions

A hot air popcorn popper triggered via the Internet! (Built for the Bellingham Codes May event.)

Add projectSign up / Login