Unable to connect my arduino yun rev 2 to blynk

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

  // 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()

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
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?

@danielp when you post serial output, compiler error messages or code to the forum it needs to be done as text (not a screenshot).
These blocks of serial output, error messages or code need to have triple backticks at the beginning and end so that they display correctly.
Triple backticks look like this:

Copy and paste these if you can’t find the correct symbol on your keyboard.

Please edit your post to correct your serial output text, and replace your screenshot with your code as text.

I would also suggest that you re-install the latest Blynk library and post the compiler error message about the BlynkSimpleYun.h library.

You should also read this…


I have edited my original post. i have also cleaned out the void loop like the post you linked did, it still isnt connecting.

Not in the code you’ve posted.

Are you sure that the compiler error message is exactly as you’ve posted, because it doesn’t match your description of the error, and doesn’t make much sense.

You’ve mentioned that you’re using mobile hotspots. This is the generally a good method of testing, especially I’ve you’re having connectivity issues.


ive edited the code to be what it is now that ie cleaned the void loop. the full compiler error is now also shown, this is everything that shows up in the output moniter when i try to compile the base code. my original description of the error may have been wrong.