[Solved] Arduino Uno USB Serial - Device Offline in Blynk 2.0

i’m using arduino uno with cable via USB Serial and device is offline.

How to solve please? Tks

Hey there, try this:

/*************************************************************
  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.
 *************************************************************
  =>
  =>          USB HOWTO: http://tiny.cc/BlynkUSB
  =>
  Feel free to apply it to any other example. It's simple!
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT DebugSerial

/* Fill-in your Template ID (only if using Blynk.Cloud) */
//#define BLYNK_TEMPLATE_ID   "YourTemplateID"


// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX

#include <BlynkSimpleStream.h>

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


void setup()
{
  // Debug console
  DebugSerial.begin(9600);

  // Blynk will work through Serial
  // Do not read or write this serial manually in your sketch
  Serial.begin(9600);
  Blynk.begin(Serial, auth);
}

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

I tried this code that is example from the library, but it doesn’t work… the device is still offline. (I replace char auth and BLYNK_TEMPLATE_ID with my information and nothing.)

Thank you for your help @John93

Your script is trying to connect to blynk-cloud.com, which is the Legacy server.
You could try editIng the script and changing the server to blynk.cloud and maybe port 8080 but not sure if USB connection is supported in Blynk IoT. Normally the Template ID is required and I don’t think the script has been updated to accommodate this.

Pete.

2 Likes

that’s it! @PeteKnight

I edited the blynk-ser.bat file by changing the line set SERV_ADDR=blynk-cloud.com to set SERV_ADDR=blynk.cloud and it is now connected. Thank you @PeteKnight

1 Like

Excellent! Wasn’t sure that it would work, but glad it did.

Pete.

1 Like

hello;
i have tried editing the blynk-ser.bat file but i am getting SetAddr(): gethostbyname(“blynk.com”) ERROR Unknown error (11001). I dont know if you can share the edited blynk-ser.bat script

Should be blynk.cloud not blynk.com

Pete.

Thanks it is online.

1 Like

I have the same problem with the same configuration. I add some code to the loop() to turn onboard LED on (pin13), but i does’t work, maybe the program is loop in Blynk.begin(). by the way, I tried to change the web address, but still offline. any advices? thanks a lot!

@Jacky I suggest that you create a new “Need help with my project” topic and provide all of the requested information, plus any other information that you think may be relevant.

Pete.

1 Like

Thanks a lot! Finally the solution is the same to collect the WEB address.

Hi guys. looking for help. i am stuck getting arduino uno linked to blynk via usb. I have the blynk-ser.bat edited to connect to blynk.cloud on port 80. and it gives these result when i run it.


but the console webpage still says the arduino is offline.
what am i doing wrong?

My guess is that you are writing debug data (in the form of serial print commands probably) to the same serial port that you are using to connect to Blynk.

However, it’s impossible to say, as you haven’t posted your sketch, or any other data that’s necessary to understand which version of Blynk you are using and what other issues may be related to your problem.

That’s why It’s best to start a new “Need help…” topic and provide all of the requested information, along with any addition information that you think is relevant.

Pete.

thank you very much!

2022
Server:sgp1.blynk.cloud
Port:8080

Edit:form File blynk-ser Tools

@Tawatchai_John

Same answer for you.

Pete.