Hi friends. I upload the below code from the blynk examples sketch to the arduino UNO with W5100 shield but after 5 second disconnected from the server !
the sketch:
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "e5aac1087ca142ceaab95e9ad3198d6e";
// Your WiFi credentials.
// Set password to "" for open networks.
char server[] = "10.5.51.5";
// Select your pin with physical button
const int btnPin = 11;
WidgetLED led3(V3);
BlynkTimer timer;
// V3 LED Widget represents the physical button state
boolean btnState = false;
void buttonLedWidget()
{
// Read button
boolean isPressed = (digitalRead(btnPin) == LOW);
// If state has changed...
if (isPressed != btnState) {
if (isPressed) {
led3.on();
} else {
led3.off();
}
btnState = isPressed;
}
}
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, server, 8080);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
// Setup physical button pin (active low)
pinMode(btnPin, INPUT_PULLUP);
timer.setInterval(500L, buttonLedWidget);
}
void loop()
{
Blynk.run();
timer.run();
}
the serial monitor log:
[0] Getting IP...
[5524] IP:10.5.51.9
[5524]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v0.5.4 on Arduino Uno
[5638] Connecting to 10.5.51.5:8080
[5688] Ready (ping: 9ms).
[10757] Connecting to 10.5.51.5:8080
[15758] Connecting to 10.5.51.5:8080
[20759] Connecting to 10.5.51.5:8080