/*
Mic,facebook Shield Example
This example shows an application on 1Sheeld's mic,facebook shield .
Simple and humorous program
By using this example, you can turn on the servo motor on pin 9 if the
smartphone's mic reports a certain noise level
So that when you finish the bathroom automatically pull Siphon through servo motor and thanks you on Facebook.
*/
/* Include 1Sheeld library. */
#include <OneSheeld.h>
#include <Servo.h>
/* A name for the LED on pin 13. */
int ledPin = 13;
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup()
{
/* Start communication. */
OneSheeld.begin();
/* Set the LED pin as output. */
pinMode(ledPin, OUTPUT);
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop ()
{
/* Always check the noise level. */
if (Mic.getValue() > 80)
{
/* Turn on the LED. */
digitalWrite(ledPin, HIGH);
/* Update your status on Facebook. */
Facebook.post("HAMAM DONE thank you :)!");
/* Wait for 300 ms. */
OneSheeld.delay(300);
myservo.write(350);
}
else
{
/* Turn off the LED. */
digitalWrite(ledPin, LOW);
myservo.write(0) ;
}
}
Comments