Wifi connection without Arduino-Ide serial.plotter

I am working with an Arduino MKR 1010 wifi and Arduino MKR ENV shield. Sending environmental data to Blynk-App on iOS. It all works fine as long as I start serial plotter in Arduino IDE once - connection to wifi is established without issues. But when I try to let the MKR rund on its own - without Arduino IDE connect - just on USB power. There is no Wifi-Connection happening. MKR is obviously waiting for instigation of the Wifi connection via serial plotter.

  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
    Follow us:                  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 use Arduino MKR 1010
  to connect your project to Blynk.

  Note: This requires WiFiNINA library
    from http://librarymanager/all#WiFiNINA

  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 <WiFiNINA.h>
#include <BlynkSimpleWiFiNINA.h>
#include <Arduino_MKRENV.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = „xxxx“;

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = „xxxx“;
char pass[] = „xxxx“;

BlynkTimer timer;

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

  if (!ENV.begin()) {
    Serial.println("Failed to initialize MKR ENV shield!");
    while (1);
  } 
  

  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);

  timer.setInterval(5000L, sendSensor);
}

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

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
  float h = ENV.readHumidity();
  float t = ENV.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
  float lx = ENV.readLux();

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
  Blynk.virtualWrite(V7, lx);
}```

What happens if you comment-out this line?:

Pete.

It works like a charm! Wonderful. Thanx for your advice!

1 Like