Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Gregory Peter
Published © GPL3+

Smartphone Garage Door Remote

A smartphone garage door remote and status sensor using Blynk and Photon.

IntermediateFull instructions provided3 hours3,694
Smartphone Garage Door Remote

Things used in this project

Hardware components

Photon
Particle Photon
×1
2-Channel 5V Relay Module
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Adafruit Magnetic contact switch
×1

Software apps and online services

Blynk
Blynk
Particle Pi
Particle Pi

Story

Read more

Schematics

Garage Door Remote

Code

Garage Door Control

C/C++
Copy and paste the code from after the #include <blynk.h> line.
// This #include statement was automatically added by the Particle IDE.
#include <blynk.h>
char auth[] = "add_your_blynk_authorization_code";
const int reedSwitch = D6;
int reedStatus = 0;
void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth);
  pinMode(D0, OUTPUT);
  pinMode(D3, OUTPUT);
  digitalWrite(D0, HIGH);
  digitalWrite(D3, HIGH);
}
BLYNK_WRITE(V1)
{
  int a = param.asInt();
  if (a == 1) {
    digitalWrite(D0, LOW); 
    } else {
    digitalWrite(D0, HIGH);
    }

}
BLYNK_READ(V5)
{
reedStatus = digitalRead(reedSwitch);
if (reedStatus == HIGH) {
    Blynk.virtualWrite(5, "Closed");
}
else {
    Blynk.virtualWrite(5, "Open");
}
}
    





void loop()
{
    Blynk.run();    
}

Credits

Gregory Peter
1 project • 1 follower

Comments