Giter Site home page Giter Site logo

blynklibrary's Introduction

The BlynkLibrary is a simplified Blynk client which supports the most basic parts of Blynk. The BlynkLibrary is a UWA DLL coded in C# and has been tested on Windows 10 (x64) and on Windows 10 IoT Core (ARM, Raspberry Pi 2). The project may be built on Visual Studio 2017 Community or similar.

The BlynkLibrary supports the following parts of Blynk:

  • Connecting and maintaining a connection to the Blynk server.
  • Writing of virtual pins from app/server to Blynk client.
  • Writing of digital pins from app/server to Blynk client.
  • Transmission of virtual pins from Blynk client to app/server.
  • Transmission of digital pins from Blynk client to app/server.
  • Read request for virtual pins from Blynk client to app/server. (Thanks to Chernega)
  • Setting widget properties from Blynk client to app/server. (Thanks to Chernega)
  • Sending virtual and digital pins to a different device through a bridge.

To use this together with the Blynk app you may not use the "Read" setting, but use "Push" and rely on the application using the BlynkLibrary, to push the values.

To include it in your project you need add the following code:

    void myInitMethod()
    {
         Int32 port = 8442;
         string server = "blynk-cloud.com";

         var AUTH = "ADD YOUR TOKEN HERE";

         Blynk myBlynk = new Blynk( AUTH, server, port );

         myBlynk.VirtualPinReceived += MyBlynk_VirtualPinReceived;
         myBlynk.DigitalPinReceived += MyBlynk_DigitalPinReceived;

         bool connected = myBlynk.Connect();
    }

    private void MyBlynk_DigitalPinReceived( Blynk b, DigitalPinEventArgs e )
    {
        // Handle your received digital pin here
    }

    private void MyBlynk_VirtualPinReceived( Blynk b, VirtualPinEventArgs e )
    {
        // Handle your received virtual pin here
    }

In addition the Blynk client offers the following API:

    /// <summary>
    /// This is the Blynk constructor.
    /// </summary>
    /// <param name="authentication">The Blynk authentication token.</param>
    /// <param name="server">Sever connection string url.</param>
    /// <param name="port">The server port to connect to.</param>
    public Blynk( string authentication, string server, int port );

    /// <summary>
    /// This method will try to establish a connection to the Blynk server.
    /// </summary>
    /// <returns>'True' if a connection is established, 'False' if not.</returns>
    public bool Connect()
    
    /// <summary>
    /// This is the virtual pin sender.
    /// </summary>
    /// <param name="vp">The virtual pin to send.</param>
    public void SendVirtualPin( VirtualPin vp );
    
    /// <summary>
    /// This is the digital pin sender.
    /// </summary>
    /// <param name="dp">The digital pin to send.</param>
    public void SendDigitalPin( DigitalPin dp )
    
    /// <summary>
    /// This is the widget set property sender
    /// </summary>
    /// <param name="vp">The virtual pin with properties to send.</param>
    public void SetProperty( VirtualPin vp )
    
    /// <summary>
    /// Reads a virtual pin.
    /// </summary>
    /// <param name="vp">The virtual pin to read.</param>
    public void ReadVirtualPin( VirtualPin vp )

blynklibrary's People

Contributors

sverrefroy avatar aleksandardev avatar

Stargazers

Rinus Pienaar avatar John Hewitt avatar  avatar  avatar  avatar Seamus avatar  avatar  avatar Matthias Winkler avatar Omer F.Khan avatar  avatar Kai Bidstrup avatar Tamas Karpati avatar Remi Ferland avatar  avatar Faraz Pourafshin avatar  avatar  avatar Latitude17 avatar Volodymyr Shymanskyy avatar

Watchers

 avatar Hakim avatar

blynklibrary's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.