Smart Garage

Starting from my laziness in opening a garage at home, and wanting to know whether the contents of the garage are empty or not, therefore I

BeginnerShowcase (no instructions)4
Smart Garage

Things used in this project

Hardware components

ESP32S
Espressif ESP32S
×1
LED, Infrared
LED, Infrared
×1
Jumper wires (generic)
Jumper wires (generic)
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
Mega-B Development Kit
Breadware Inc Mega-B Development Kit
×1

Software apps and online services

Arduino IDE
Arduino IDE
Blynk
Blynk

Hand tools and fabrication machines

Multitool, Screwdriver
Multitool, Screwdriver

Story

Read more

Schematics

wiring

Code

Coding

C/C++
#define BLYNK_TEMPLATE_ID           "TMPLxxxxxx"
#define BLYNK_DEVICE_NAME           "Device"
#define BLYNK_AUTH_TOKEN            "YourAuthToken"


// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial


#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>


char auth[] = "Input your token";
char ssid[] = "Xxxx";
char pass[] = "Xxxx";



#include <Servo.h>
Servo servo1;
Servo servo2;


WidgetLED led1(V4);
WidgetLED led2(V3);
int sensor1 = 15;
int sensor2 = 2;

void setup()
{
  // Debug console
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass, "blynk-cloud.com",8080);

  pinMode(sensor2,INPUT);
  pinMode(sensor1,INPUT);
servo1.attach(4);// 13 pin
servo2.attach(5);// 12 pin


  while (Blynk.connect() == false) {
  }
}

void loop() {
  Blynk.run();
  int sensorval1 = digitalRead(sensor1);
  int sensorval2 = digitalRead(sensor2);
  Serial.println(sensorval1);
  Serial.println(sensorval2);
  delay(1000);
  
    if (sensorval1 == 1)
    {
  led1.on();
  }
    if (sensorval2 == 1)
    {
  led2.on();
  }

    if (sensorval1 == 0)
    {
  led1.off();
  }
    if (sensorval2 == 0)
    {
  led2.off();
  }

  delay(500);
  Blynk.run();
}


 
BLYNK_WRITE(V1)
{
   servo1.write(param.asInt());
}

BLYNK_WRITE(V2)

{
   servo2.write(param.asInt());
}

Credits

Rizki Oktapriansa

Rizki Oktapriansa

0 projects • 0 followers
Aldhi Adytia Prasetio 24776

Aldhi Adytia Prasetio 24776

2 projects • 0 followers

Comments

Add projectSign up / Login