I’m having a problem with my code, When I do it without blynk it works but when I add blynk it doesn’t work
Here are my codes with and without blynk
WITHOUT BLYNK
int sensor =13;
int buzzer = 0;
int sensorstate= 0;
//button
int buttonPin = 2;
int buttonState=0;
// input 1
int input1 =12; //
int input1state=0;
// input 2
int input2 =14; //
int input2state=0;
//input 3
int input3 =4;
int input3state=0;
int pin=16;
int pins=5;
void setup() {
pinMode(buzzer,OUTPUT);
pinMode(sensor,INPUT);
pinMode(input1,INPUT);
pinMode(input2,INPUT);
pinMode(input3,INPUT);
pinMode(pin,OUTPUT);
pinMode(pins,OUTPUT);
}
void sensorers(){
sensorstate=digitalRead(sensor);
if (sensorstate==HIGH)
{
digitalWrite(buzzer,HIGH);
digitalWrite(pin,LOW);
digitalWrite(pins,HIGH);
}
else{
digitalWrite(buzzer,LOW);
digitalWrite(pin,HIGH);
digitalWrite(pins,LOW);
}
}
void callpanicbutton(){
//own loop
buttonState = digitalRead(buttonPin);
/////////
}
void callinput1(){
//own loop
input1state = digitalRead(input1);
}
void callinput2(){
//own loop
input1state = digitalRead(input2);
}
void callinput3(){
//own loop
input1state = digitalRead(input3);
}
void loop() {
sensorers();
callpanicbutton();
callinput1();
callinput2();
callinput3();
}
WITH BLYNK
//sensors
int sensor =13;
int buzzer = 0;
int sensorstate = 0;
//button
int buttonPin = 2;
int buttonState=0;
#define BLYNK_PRINT Serial
//input 1
int input1 =12; //
int input1state=0;
//input 2
int input2 =14;
int input2state=0;
//input 3
int input3 =4;
int input3state=0;
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = " uEv7YIPD4ytrrx9zFABHqS89vaG9gjro";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "MBEVA";
char pass[] = "mashimbye";
BlynkTimer timer;
void myTimerEvent()
{
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V5, millis() / 1000);
}
void callpanicbutton(){
//own loop
buttonState = digitalRead(buttonPin);
}
void setup()
{
pinMode(input1,INPUT);
pinMode(input2,INPUT);
pinMode(input3,INPUT);
pinMode(buzzer,OUTPUT);
pinMode(sensor,INPUT);
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
//Setup a function to be called every second
timer.setInterval(1000L, myTimerEvent);
}
void sensorers(){
sensorstate=digitalRead(sensor);
if (sensorstate==HIGH)
{
digitalWrite(buzzer,HIGH);
Blynk.notify("MOVEMENT IN THE STORE");
}
else{
digitalWrite(buzzer,LOW);
}
}
void callinput1(){
//own loop
input1state = digitalRead(input1);
}
void callinput2(){
input2state = digitalRead(input2);
}
void callinput3(){
//own loop
input3state = digitalRead(input3);
}
void loop()
{
Blynk.run();
timer.run(); // Initiates BlynkTimer
sensorers();
callpanicbutton();
callinput1();
callinput2();
callinput3();
}