Today we will be trying to take over the world by building this Smartphone Bluetooth controlled Outlet.
Check us out on Facebook!
Parts List:
affiliate links
Point to Point Solder Bread Board
6″ of 3″ PVC Pipe
3″ PVC end Cap
3″ pvc Knock out end Cap
3″ Toilet Bracket thingy
Power Cord
Screws
Wire
ARDUINO Code:
#define relay 2
int state = 0;
void setup() {
Serial.begin(9600);
pinMode(relay, OUTPUT);
}
void loop() {
if (Serial.available() >= 2 )
{
unsigned int a = Serial.read();
unsigned int b = Serial.read();
unsigned int val = (b * 256) + a;
if (val == 1234 && state == 0) // relay on
{
digitalWrite(relay, HIGH);
state = 1;
}
else if (val == 1234 && state == 1) // relay off
{
digitalWrite(relay, LOW);
state = 0;
}}}
The APP:
Click here to download the APP