BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Raspberry PI + blynk

#1

If I use the examples from the website, there is no part in the program that connects the raspberry pi to the server or a place where I can type my auth key. Does somebody now what I have to change to the examples to let it connect to the server.

0 Likes

#2

Assuming you are using the RPi as a Blynk Client and not hosting a Local Server… then how to program your client sketch depends on the programming language you use for your Blynk Client in the RPi (NodeJS, Python, WiringPi)

You will have to examine examples for each Library type to see how they utilise Blynk, as the primary Blynk Sketch Builder examples are for Arduino/ESP, not RPi

For example NodeJS…

For Python…

And I never use WiringPi anymore… so no idea.

0 Likes

#3

I think that what @User265 was saying is that in the sketch builder examples for RPI, he can’t work-out where to add in the Auth code. (Neither can I)…

/*************************************************************
  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.

 *************************************************************

  You’ll need:
   - Blynk App (download from AppStore or Google Play)
   - Raspberry Pi board
   - Decide how to connect to Blynk
     (USB, Ethernet, Wi-Fi, Bluetooth, ...)

  There is a bunch of great example sketches included to show you how to get
  started. Think of them as LEGO bricks  and combine them as you wish.
  For example, take the Ethernet Shield sketch and combine it with the
  Servo example, or choose a USB sketch and add a code from SendData
  example.
 *************************************************************/

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

#ifdef RASPBERRY
 #include <BlynkApiWiringPi.h>
#else
 #include <BlynkApiLinux.h>
#endif
#include <BlynkSocket.h>
#include <BlynkOptionsParser.h>

static BlynkTransportSocket _blynkTransport;
BlynkSocket Blynk(_blynkTransport);
#include <BlynkWidgets.h>

void setup()
{
}

void loop()
{
  Blynk.run();
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!
}

int main(int argc, char* argv[])
{
  const char *auth, *serv;
  uint16_t port;
  parse_options(argc, argv, auth, serv, port);

  Blynk.begin(auth, serv, port);

  setup();
  while(true) {
    loop();
  }

  return 0;
}

I guess it’s somewhere here:

  const char *auth, *serv;
  uint16_t port;
  parse_options(argc, argv, auth, serv, port);

  Blynk.begin(auth, serv, port);

This seems to be the variable declaration, but I’m not sure of the syntax for assigning a value for the variable once/when it’s declared.

BTW, when you type something in the optional Auth code box, it doesn’t appear within the sketch at the appropriate place.

Pete.

0 Likes

#4

That is because the Sketch Builder is technically still assuming Arduino/ESP type C++ code via WiringPi

And based on what I have seen… WiringPi is the least supported of the RPi Blynk, client options.

But searching this forum for the key word WiringPi will at least get the OP started on the reading/learning curve… I think.

I do recall some of my early attempts to get WiringPi running on my Local Server are floating around in this forum… but basically gave up as I much prefer the other programming options :stuck_out_tongue:

1 Like