BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

'Undefined ref' issues in quickstart

Hey all.

Probably a noob question but I’m hitting a wall as I follow the device quickstart guide. Running an Arduino Uno over USB using the stock IDE.

Unfortunately the code given in the quickstart is not even compiling for me. Can’t help but feel like something’s missing but I’m copying it verbatim and it’s throwing errors. Library is installed in the right place, picked right board in the IDE, etc. Here is the code from the quickstart;

#define BLYNK_TEMPLATE_ID "xxxxxxxxxxxx"
#define BLYNK_DEVICE_NAME "Quickstart Device"
#define BLYNK_AUTH_TOKEN "xxxxxxxxxxxxxxxxxxxxxxxx"

And it’s giving these errors;

C:\Users\xxxx\AppData\Local\Temp\ccnPOoqf.ltrans0.ltrans.o: In function `main':
C:\Users\xxxx\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5\cores\arduino/main.cpp:43: undefined reference to `setup'
C:\Users\xxxx\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5\cores\arduino/main.cpp:46: undefined reference to `loop'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Uno.

Seems like something obvious but just confusing because I’m following the guide exactly.

Post your whole sketch please ?

This is not a sketch, you should add it to your sketch.

Take a look at the image, if you click here it will take you to the examples, choose an example, board, and connection method then upload it to your board.

You should follow these steps…

Pete.

I’m now trying one of the examples filled in with my device info. It compiles now but still no connection in the quickstart.

Still using Arduino Uno over USB via the Blynk web console.

#define BLYNK_TEMPLATE_ID "TMPLhcdxFzyC"
#define BLYNK_DEVICE_NAME "Quickstart Device"
#define BLYNK_AUTH_TOKEN "xxxxx"

/* 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   "TMPLhcdxFzyC"


// 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[] = "xxxxx";


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();
}

Have you edited the USB script to point it to blynk.cloud rather than blynk-cloud.com .

If you have an FTDI connected to pins 2&3, what do you see in the debug serial monitor?

Pete.

Nope - could you tell me where to do that? Not seeing it anywhere in the sketch

It’s not in the sketch, it’s in the batch file that you run on your computer to enable the USB connection.

Pete.

1 Like

Ahh I knew I was missing something. Got the batch file set up and everything looks like it’s connecting fine now. Thanks for your patience