Elegoo Uno (Arduino equivalent)
Ethernet Shield
Blynk Android app
This is my first post here so firstly I would like to say hello and would appreciate any help and suggestions offered to me.
I’m Having trouble staying connected to my Blynk app on my android device (Galaxy S5 Neo)
Fact of the matter is that I was having less of a problem when I had a “Dirty Loop” so to speak but was having trouble none the less.
Now I have followed the standard Blynk.run() timer.run() process and seem to loose connection almost immediately
#include <BlynkSimpleEthernet.h> //include Blynk Library
#include <Adafruit_Sensor.h> //Include sensor Library
#include <DHT.h> //Include dht sensor library
#include <LiquidCrystal.h> //Include LCD Library
#include <SPI.h> //Include Serial Peripheral Interface (SPI)
#include <Ethernet.h> //Include Ethernet Library
// 29/10/2019
// Authors: ##########################
/* The LCD circuit:
* LCD RS pin to digital pin 7
* LCD Enable pin to digital pin 6
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* LCD VSS pin to ground
* LCD VCC pin to 5V
* LCD VO pin (pin 3)to potentiometer
*/
// initialize the LCD interface pins
int RS = 7; //Register Select Pin
int E = 6; //LCD Enable Pin
int D4 = 5; //Data Pin 1
int D5 = 4; //Data Pin 2
int D6 = 3; //Data Pin 3
int D7 = 2; //Data Pin 4
LiquidCrystal lcd(RS, E, D4, D5, D6, D7); //Initialize LCD
#define ENABLE 8 //Enable pin for L293D Microcontroller
#define FanOn 10 //Direction Pin for fan on Microcontroller
#define DHT_TYPE DHT11 //Sensor Type
#define DHT_PIN 9 //Sensor Pin
float temperature; //hold temperature
float humidity; //hold humidity
DHT dht = DHT(DHT_PIN, DHT_TYPE); //Initialize Sensor
BlynkTimer timer;
char auth[] = "##############"; //Authentication Key to speak to blink server( Our Project )
bool sendMail = true; //Boolean to control when a mail is sent
void setup() {
/*
* A setup function to initialize pin states
* Write initial values to Lcd
*/
Serial.begin(9600);
EthernetClient client;
byte mac[] = { 0xA8, 0x61, 0x0A, 0xAE, 0x13, 0x66 };
Ethernet.begin(mac);
Blynk.begin(auth); //Connect with blynk server , passed ( auth ) our authentication key
pinMode(ENABLE,OUTPUT); //Set enable pin as output pin
pinMode(FanOn,OUTPUT); //Set FanOn pin as output
dht.begin(); //Begin reading from sensor
lcd.begin(16, 2); //set up the LCD's number of columns ( 16 ) and rows ( 2 )
lcd.print(Ethernet.localIP());
delay(2000);
lcd.clear();
lcd.print("#########"); //Print first Autor to the LCD
lcd.setCursor(0,1); //Move LCD input to next row
lcd.print("########"); //Print second Author to LCD
lcd.noBlink(); //Stop the LCDcursor from blinking
delay(2000);
Blynk.virtualWrite(V3, Ethernet.localIP());
timer.setInterval(1000L, printBlynkLCD);
}
void loop() {
/*
* This is the main Loop, this function runs continuously
*/
Blynk.run();
timer.run();
}
void printBlynkLCD()
{
/*
* Function to print to VIRTUAL lcd ( Blynk Server )
* V0 is the first row on the virtual LCD
* V1 is the second row on the virtual LCD
*/
Blynk.virtualWrite(V0, temperature);
Blynk.virtualWrite(V1, humidity);
}