Arduino mkr 1010 rimane nel setup - Troubles using Blynk.config()

Salve come già scritto ho tutti i tipi di arduino e tutti si connettono al server di Blynk
con la funzione Blynk.begin(); e riesco a settarli sia wifi che con ethernet
ma come modifico il codice con Blynk.config(); seguito da Blynk.connect();
resta bloccato nel setup.
In questo forum come posso postare il codice corretamente ?

And again we answer… this depends on your hardware…

For example with WiFi you need to set that up first…

  WiFi.begin(ssid, pass);  // This sets up the WiFi network
  Blynk.config(auth, server, port);  //  This sets up Blynk - Non-blocking if no WiFi available
  Blynk.connect();  // This attempts to connect to the Server - Non-blocking if no WiFi available

Find out how to connect your hardware to the network first, then follow up with Blynk.config() and Blynk.connect()

The process is:

  • Add the necessary libraries to allow your hardware to connect to the internet (these will vary depending on your hardware and connection method)
  • Set-up a connection to the internet (this will vary depending on your hardware, whether you are a using static or DHCP allocated IP address, whether your devices requires a MAC address to be specified etc.)
  • Define your Blynk connection credentials in Blynk.config()
  • Connect to Blynk using Blynk.connect()

After you’ve set-up the internet connection you should be able to ping the device and use the device to ping external IP addresses. You should also be able to see the device in your router admin screen.

Rather than saying “I have lots of devices, lots of connection methods, and have tried lots of code”, I would suggest that you focus on one device, one connection method and share the details and the code you’ve tried, along with any useful information such as serial monitor output, ping results etc.

Pete.

1 Like

As per the Welcome Topic…

Blynk%20-%20FTFC

/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Social networks:            http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  This example shows how to configure static IP with Ethernet.
  Be sure to check ordinary Ethernet example first!!!

  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

  Feel free to apply it to any other example. It's simple!
 *************************************************************/

/* Comment this out to disable prints and save space */
#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[] = "41xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

//IPAddress server_ip (192, 168, 1, 100);

// Mac address should be different for each device in your LAN
byte arduino_mac[] = { 0x90, 0xA2, 0xDA, 0x10, 0x21, 0x99 };
IPAddress arduino_ip ( 192,   168,   1,  200);
IPAddress dns_ip     (  8,   8,   8,   8);
IPAddress gateway_ip ( 192,   168,   1,   1);
IPAddress subnet_mask(255, 255, 255,   0);

#define W5100_CS  10
#define SDCARD_CS 4

void setup()
{
  // Debug console
  Serial.begin(9600);

  pinMode(SDCARD_CS, OUTPUT);
  digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card

  //Blynk.begin(auth, server_ip, 8080, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);
  // Or like this:
  //Blynk.begin(auth, "blynk-cloud.com", 80, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);//      con questo si connette al server
  Blynk.config(auth, "blynk-cloud.com", 80, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);//       con questo mi da sempre errore
  Blynk.connect();
}

void loop()
{
  Blynk.run();
}

Backticks, not commas… I fixed your post :wink:

When using Blynk.config(), all it is interested in is the server address, port and auth…

Blynk.config(auth, "blynk-cloud.com", 80);

The rest of the Ethernet info needs to happen first in other non-blynk commands… just as if you were connecting an Arduino to your network before ever finding out about Blynk.

Do you have any other devices on your network that you’ve allocated the same MAC address to?
Your router and Ethernet switches wont tolerate two devices on the network with the same MAC. If you’re unsure then download this and scan you network:

Pete.