[SOLVED] Device offline (UNO using USB-link)

Yeah its physically plugged in this time

Yup and the blynk-ser.bat file is also running

OK, is the batch file running in the background… and can you screenshot what it looks like for us?

OK… which method are you physically using to connect your UNO to the network with… USB or Ethernet??? You have shown two sketches, neither that will work with the other sketches method.

This is the .bat file window
But one thing i don’t understand it now when i uploaded the sketch 1 where virtual pin 5 is used its working and is online but the below sketch where virtual pin 1 is used isn’t working as i uploaded it and run blynk app mean it still is giving me the same msg

@Imran123 the sketches will only work if they tie exactly to the widgets you have in your project.

Something is clearly interrupting the serial connection… please stop using the sketch for the ethernet and let’s focus on the proper one for the USB.

When using the USB link… absolutely NOTHING else can use that same port; No serial prints in the sketch and no serial monitor in the IDE… otherwise disconnections will happen.

i am using dsl to connect my arduino with the network through router.
and my arduino is connected with my laptop through usb port
Okay
Now bro ya saying that i should comment out all the serial print commands

Unless you have a physical shield with an RJ11 network port on it… you are NOT directly using ethernet on the Arduino.

What the USB-link does is turn your laptop into an oversized serial to ethernet adapter, but as far as the UNO and sketch is concerned, you are using the serial port.

Since the USB link is on the primary (and on the UNO only) UART port… aka Serial you can only print to the SwSerial port, and only if you have a TTL-USB adapter connected to pins 10 & 11.

Yes you need a USB2TTL tied to these pins if you want to see Serial Monitor (SM). Keep SM closed and work “blind” for now.

ok
Thanks bro

Ok Thanks bro

@vshymanskyy I think the supplementary docs for USB refer to the need for a USB2TTL adaptor but I think the sketch should too and the implications for Serial Monitor and Serial.print().

@Imran123 Something to note… if you do have a USB-TTL adapter, then it will get it’s own port in the PC, but you CAN NOT use the IDE SM to view it, as the IDE SM will always grab the programming port (currently being used by the USB-link).

Using another terminal program like Termite will work in that case.

1 Like

New progress
I have runned the following code and it run successfully

//#define BLYNK_PRINT SwSerial  // ONLY AVAILABLE IF YOU HAVE A USB2TTL

//#include <SoftwareSerial.h>  // ONLY AVAILABLE IF YOU HAVE A USB2TTL
//SoftwareSerial SwSerial(10, 11); // RX, TX  ONLY AVAILABLE IF YOU HAVE A USB2TTL
    
#include <BlynkSimpleStream.h>

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

BlynkTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void myTimerEvent()
{
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  if(analogRead(A1>0))
     Blynk.virtualWrite(V5, 255);
  else
    Blynk.virtualWrite(V5,0);
}

void setup()
{
  // Debug console ONLY AVAILABLE IF YOU HAVE A USB2TTL
  //SwSerial.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);

  // Setup a function to be called every second
  timer.setInterval(1000L, myTimerEvent);
}

void loop()
{
  Blynk.run();
  timer.run(); // Initiates BlynkTimer
}
1 Like

Nope no USB-TTL adapter till now, but i will get one soon

In that case I have edited your last sketch.

Thanks alot Gunner and Costas for helping me out in this problem
I can’t express it but,
YOU ARE THE BEST
Thanks again bro’s

1 Like

2 posts were split to a new topic: I changed some code and now it does upload. Using blynk-ser.bat

hey #Costas #Imran123 #Gunner …dudezz lov u a lott…My entire college students couldnt do this,even final yea studentz…but i made it with ua helpp…
Thanx a lot buddieeessss…