hi, i was trying to connect via static ip.
but it is not connecting.
i used the following:
/*************************************************************
This example shows how to use Arduino Ethernet shield (W5100)
to connect your project to Blynk.
NOTE: Pins 10, 11, 12 and 13 are reserved for Ethernet module.
DON'T use them in your sketch directly!
WARNING: If you have an SD card, you may need to disable it
by setting pin 4 to HIGH. Read more here:
https://www.arduino.cc/en/Main/ArduinoEthernetShield
This is a simple demo of sending and receiving some data.
Be sure to check out other examples!
*************************************************************/
/* Fill-in information from Blynk Device Info here */
#define BLYNK_TEMPLATE_ID "XXXXXXXXXXXXX"
#define BLYNK_TEMPLATE_NAME "Quickstart Template"
#define BLYNK_AUTH_TOKEN "XXXXXXXXXXXXXXXXXXXXXXXXX_XXXXXX"
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#define W5100_CS 10
#define SDCARD_CS 4
IPAddress server_ip (128, 199, 144, 129);
byte device_mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
IPAddress device_ip (192, 168, 50, 165);
IPAddress dns_ip (8, 8, 8, 8);
IPAddress gateway_ip (192, 168, 50, 1);
IPAddress subnet_mask(255, 255, 255, 0);
BlynkTimer timer;
// This function is called every time the Virtual Pin 0 state changes
BLYNK_WRITE(V0)
{
// Set incoming value from pin V0 to a variable
int value = param.asInt();
// Update state
Blynk.virtualWrite(V1, value);
}
// This function is called every time the device is connected to the Blynk.Cloud
BLYNK_CONNECTED()
{
}
void myTimerEvent()
{
Blynk.virtualWrite(V2, millis() / 1000);
}
void setup()
{
Serial.begin(9600);
pinMode(SDCARD_CS, OUTPUT);
digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card
Blynk.begin(BLYNK_AUTH_TOKEN, "blynk.cloud", 80, device_ip, dns_ip, gateway_ip, subnet_mask, device_mac);
timer.setInterval(1000L, myTimerEvent);
}
void loop()
{
Blynk.run();
timer.run();
}
Heres the output:
[12862] Using static IP
[14423] IP:192.168.50.165
[14424]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v1.3.0 on Arduino
#StandWithUkraine https://bit.ly/swua
[14589] Connecting to blynk.cloud:80
[16248] Connecting to blynk.cloud:8080
[19589] Connecting to blynk.cloud:80
[21209] Connecting to blynk.cloud:8080
[24590] Connecting to blynk.cloud:80
[26210] Connecting to blynk.cloud:8080
[29591] Connecting to blynk.cloud:80
[31211] Connecting to blynk.cloud:8080