I am having issues w/ the MKR1000 board in the Blynk environment. Below pls find a test sketch I ran successfully multiple times about a month or so ago, which no longer works reliably. Upon running the sketch now, connection to Blynk establishes successfully may be 1 in 10 tries. I am unclear why it doesn’t work reliably now.
The Wifi is robust (my computer is attached to it as well), and I tried this on two different Wifi networks with the same results. An Arduino example sketch scanning networks successfully picks these up. I believe the Wifi functionality is fine/operational. This behavior seems idiosyncratic.
Has anybody observed this? What are suitable troubleshooting strategies?
Thanks in advance.
Andreas
Supporting information:
Serial port read-back when it doesn’t work:
[5001] Connecting to blynk-cloud.com:8442
[25002] Connecting to blynk-cloud.com:8442
[45003] Connecting to blynk-cloud.com:8442
[65004] Connecting to blynk-cloud.com:8442
[85005] Connecting to blynk-cloud.com:8442
[105006] Connecting to blynk-cloud.com:8442
This keeps going on indefinitely.
The few times it works, after the 1st attempt at connecting serial port read-back:
ready (ping: 36ms)
Blynk version 0.4.7., Arduino 1.8.2, Wifi101 0.14.2
Test sketch code:
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <SPI.h>
#include <WiFi101.h>
#include <BlynkSimpleMKR1000.h>
const int testpin = A0;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxxxxxx";
char ssid[] = "xxxxxxxxxxxxxx"; // your network SSID (name)
char pass[] = "xxxxxxxxxxxxxx"; // your network password
unsigned long currenttime; // Variables needed to trigger timed event
unsigned long previoustime = 0; // Variables needed to trigger timed event
unsigned long interval = 10000; // Variables needed to trigger timed event
void setup() {
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// Or specify server using one of those commands:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
//Blynk.begin(auth, ssid, pass, server_ip, port);
}
void loop()
{
Blynk.run();
test();
}
////// function outside of loop to capture and upload data to Blynk
void test(){
int measurement = analogRead(testpin);
Serial.println(measurement);
//Every 10 seconds, print some BS
currenttime = millis();
if(currenttime - previoustime > interval){
Serial.println("Timed event every 10 sec"); //embed code to send data to Thingspeak here
Blynk.virtualWrite(V5, measurement);
Blynk.virtualWrite(V6, measurement);
previoustime = currenttime;
}
delay(250);
}