nawfaldo
Published © GPL3+

Ir sensor with arduino

This sensor is good for smart parking

BeginnerProtip1 hour312
Ir sensor with arduino

Things used in this project

Hardware components

IR Range Sensor
Digilent IR Range Sensor
×1
NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Untitled file

C/C++
#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "Ukf1peHwA2XUkbyFtgLU3zL81RTFu5Wp";   //token dari akun blynk
char ssid[] = "smbt";     //ssid wifi yang terhubung
char pswd[] = "masnepi2028";            // password wifi yang terhubung

WidgetLED led1(V1);            // Virtual LED untuk menampilkan status di aplikasi
int sensor1 = D4;                   //IR sensor


void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pswd);
  pinMode(sensor1, INPUT);
  while (Blynk.connect() == false) {
  Serial.println("tidak terkoeksi");
  }
}
void loop()
{
  int sensorval1 = digitalRead(sensor1);
  delay(1000);
if (sensorval1 == 1)
  {
led1.on();
  }
if (sensorval1 == 0)
  {
led1.off();
  }
  Blynk.run();
}

Credits

nawfaldo
9 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.