Hello, I am new to Blynk. I am trying to use the Arduino OTA and Blynk library on a mkr1000.
The problem is that I lose communication with the Blynk application and the mkr1000.
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <WiFi101.h>
#include <ArduinoOTA.h>
#include <BlynkSimpleMKR1000.h>
#include "arduino_secrets.h"
#define dos 2
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
/////// Wifi Settings ///////
char auth[] = "eWztXuaiQm9xBFK9uvxpKiC_eJCYLisO";
char ssid[] = "precise24G";
char pass[] = "costaR1ca";
int pinvalue;
int status = WL_IDLE_STATUS;
BLYNK_WRITE(V1)
{
pinvalue = param.asInt();
if(pinvalue==true){
digitalWrite(dos,1);
}
else {
digitalWrite(dos,0);
}
}
void setup() {
//Initialize serial:
Serial.begin(9600);
Blynk.begin(auth,ssid,pass);
pinMode(dos,OUTPUT);
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
while (true);
}
// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
}
// start the WiFi OTA library with internal (flash) based storage
ArduinoOTA.begin(WiFi.localIP(), "Arduino", "password", InternalStorage);
// you're connected now, so print out the status:
printWifiStatus();
}
void loop() {
Blynk.run();
// check for WiFi OTA updates
ArduinoOTA.poll();
// add your normal loop code below ...
}
void printWifiStatus() {
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print your WiFi shield's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}