im attempting to connect my arduino yun to blynk but when i upload my code and check my serial monitor, it shows
[60424] Connecting to blynk.cloud:8080
[65763] Connecting to blynk.cloud:80
[70985] Connecting to blynk.cloud:8080
[76199] Connecting to blynk.cloud:80
this continues endlessly, and everytime it does, the tx light on my arduino flashes red. this is my code
#define BLYNK_TEMPLATE_ID "TMPL4Krrkxw0m"
#define BLYNK_TEMPLATE_NAME "IOT Project"
#define BLYNK_AUTH_TOKEN "HJMTYnHCRcbFYwUVIjlILseDy0HxlCcz"
#define BLYNK_PRINT Serial
#include <Bridge.h>
#include <BlynkSimpleYun.h>
const int ledPin = A0;
const int btnPin = A1;
int btnState = 0;
BlynkTimer timer;
void setup()
{
// Debug console
Serial.begin(115200);
//Blynk.begin(BLYNK_AUTH_TOKEN);
// You can also specify server:
Blynk.begin(BLYNK_AUTH_TOKEN, "blynk.cloud", 8080);
//Blynk.begin(BLYNK_AUTH_TOKEN, IPAddress(), 8080);
pinMode(ledPin, OUTPUT);
pinMode(btnPin, INPUT);
timer.setInterval(1000L, sensorDataSend);
}
void sensorDataSend()
{
btnState = digitalRead(btnPin);
if (btnState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
Blynk.logEvent("Security_Notification", String("Motion Detected!"));
} else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
}
void loop()
{
Blynk.run();
timer.run();
}
the only possible issue i can think of is that when i installed the blynk library and first compiled my code, i got an error saying that in the blynksimpleyun script there was a #endif with no #if attached, so i opened the script, saw a #endif statement at the very end with no #if attached and removed it. this is the compiler error message
In file included from C:\Users\Dtpol\Documents\Arduino\bigSketch\bigSketch.ino:8:0:
C:\Users\Dtpol\Documents\Arduino\libraries\Blynk\src/BlynkSimpleYun.h:77:2: error: #endif without #if
#endif
^~~~~
exit status 1
Compilation error: exit status 1
also, originally i put 80 instead of 8080 on the blynk.begin line, but i changed it after seeing it listed as a possible solution. when it was 80, the connecting message looped in the same way but each 8080 was 80 and each 80 was 8080. i have connected my computer to multiple mobile hotspots and this hasnt changed anything. does anyone have any suggestions?