Javascript required
Skip to content Skip to sidebar Skip to footer

Can You Upload a Music File Through Blynk

#Widgets Widgets are interface modules. Each of them performs a specific input/ output function when communicating with the hardware.

In that location are 4 types of Widgets:

  • Controllers - used to send commands that control your hardware
  • Displays - used for data visualization from sensors and other sources;
  • Notifications - send messages and notifications;
  • Interface - widgets to perform certain GUI functions;
  • Other - widgets that don't belong to any category;

Each Widget has it's ain settings. Some of the Widgets (e.g. Bridge) simply enable functionality and they don't have any settings.

Common Widget Settings

Pivot Selector

This is i of the main parameters you lot demand to ready. It defines which pin to command or to read from.

Digital Pins - correspond physical Digital IO pins on your hardware. PWM-enabled pins are marked with the ~ symbol

Analog Pins - represent physical Analog IO pins on your hardware

Virtual Pins - accept no physical representation. They are used to transfer any data between Blynk App and your hardware. Read more virtually Virtual Pins here.

Data Mapping

In case you desire to map incoming values to specific range you may apply mapping button:

Let'southward say your sensor sends values from 0 to 1023. But you lot want to display values in a range 0 to 100 in the app. When Information Mapping enabled, incoming value 1023 will be mapped to 100.

SPLIT/MERGE

Some of the Widgets can send more than i value. And with this switch you tin control how to send them.

  • Split: Each of the parameters is sent directly to the Pivot on your hardware (e.grand D7). Yous don't need to write any code.

    Notation: In this mode yous send multiple commands from ane widget, which tin can reduce functioning of your hardware.

    Example: If you have a Joystick Widget and information technology's set up to D3 and D4, it will send 2 commands over the Net:

                      digitalWrite(three, value);                  digitalWrite(iv, value);
                              - **MERGE:** When MERGE mode is selected, y'all are sending but 1 bulletin, consisting of array of values. But you'll need to parse it on the hardware.   	This mode can exist used with Virtual Pins just. 	 	Example: Add together a zeRGBa Widget and gear up it to MERGE fashion. Choose Virtual Pin V1 	 	```cpp 	BLYNK_WRITE(V1) // There is a Widget that WRITEs information to V1  	{ 	  int r = param[0].asInt(); // get a RED channel value 	  int g = param[1].asInt(); // get a Green channel value 	  int b = param[2].asInt(); // get a Bluish channel value 	}                          

Decimals

Defines how many decimals you would similar to run across when moving a Slider. When "No Fraction" is chosen, slider will simply ship integer values with no decimals. "1 digit" means that values volition look like 1.i, i.two, ..., two.0, etc.

Send On Release

This option allows you to optimize data traffic on your hardware.

For example, when you motility joystick widget, commands are streamed to the hardware, during a single joystick move yous can send dozens of commands. There are use-cases where it'southward needed, however creating such a load may lead to hardware overload and reset. Ship On Release is a recommended setting for majority of applications. This is too a default setting.

Write interval

Similar to "Send on Release" option. Notwithstanding, information technology allows you to stream values to your hardware inside certain interval. For instance, setting write interval to 100 ms means that while you move the slider, only 1 value will be sent to hardware inside 100 ms period. This option is also used to optimize data traffic flow to your hardware.

Color gradient

When y'all cull slope, information technology affects the color of widget elements based on invoming values. For case: You fix Gauge Widget with Min and Max parameters of 0-100, and cull green-xanthous-red gradient. When hardware sends:

  • 10, Gauge will change it'due south color to greenish color
  • 50 volition change Estimate to yellow color
  • 80 volition change Gauge to cherry color

At that place are 2 types of gradients you tin cull from:

  • Warm: Green - Orange - Cherry;
  • Cold: Green - Blue - Violet;

##Controllers

Button

Works in push or switch modes. Allows to transport ON and OFF (Low/HIGH) values. Push button sends 1 (HIGH) on printing and sends 0 (LOW) on release.

Sketch: BlynkBlink

Slider

Similar to potentiometer. Allows to send values betwixt in a given MIN/MAX range.

Sketch: BlynkBlink

Timer

Timer triggers actions at a specified time. Even if smartphone and app is offline. Start time sends ane (Loftier). Cease time sends 0 (LOW).

Recent Android version also has improved Timer inside Eventor widget. With Eventor Time Event you can assign multiple timers on same pin, transport whatsoever string/value, select days and timezone. It is recommended to utilize Eventor over Timer widget. Notwithstanding Timer widget is still suitable for elementary timer events.

NOTE: The timer widget rely on the server fourth dimension and not your telephone time. Sometimes the phone fourth dimension may not match the server time.

Sketch: Timer

Joystick

Control servo movements in 4 directions

####Settings:

  • SPLIT/MERGE modes - read hither

  • Rotate on Tilt

When it's ON, Joystck will automatically rotate if you apply your smartphone in mural orientation

  • Auto-Return

When it's OFF, Joystick handle will not return back to eye position. It will stay where you left it.

Sketch: JoystickTwoAxis

zeRGBa

zeRGBa is a usual RGB color picker + brightness picker

Settings:

  • Divide: Each of the parameters is sent direct to the Pin on your hardware (e.grand D7). You don't need to write whatsoever code.

Annotation: In this mode you lot transport multiple commands from one widget, which tin can reduce performance of your hardware.

Example: If you have a zeRGBa Widget and it's prepare to D1, D2, D3 it volition ship 3 commands over the Internet:

              digitalWrite(ane, r);              digitalWrite(2, 1000);              digitalWrite(3, b);
  • MERGE: When MERGE way is selected, you send 1 bulletin with an array of values inside. You would demand to parse the message on the hardware.

This fashion can be used with Virtual Pins only.

Case: Add a zeRGBa Widget and prepare it to MERGE mode. Choose Virtual Pin V1.

              BLYNK_WRITE(V1)                              //                zeRGBa assigned to V1                            {                              //                get a Scarlet aqueduct value              int              r = param[0].asInt();                              //                get a Green channel value              int              one thousand = param[1].asInt();                              //                become a BLUE aqueduct value              int              b = param[2].asInt(); }

Pace Control

Pace Command is used to set granular values with a given pace

2 buttons are assigned to one pin. I push increments the value, another one decrements information technology.

Send Step option allows you to send step value to hardware instead of actual value of stride widget. Loop value choice allows you to reset pace widget to starting time value when maximum value is reached.

Sketch: Basic Sketch

##Displays

Value Display

Displays incoming data.

Sketch: BlynkBlink

Labeled Value

Displays incoming data in a formatted wayt. It is a meliorate version of 'Value Brandish' where y'all can add suffixes and prefixes on the app side, with no coding on the hardware.

Sketch: BlynkBlink

Formatting options

For example: your sensor sends vaule of 12.6789 to Blynk application. Adjacent formatting options are supported:

/pivot/ - displays the value without formatting (12.6789)

/pin./ - displays the rounded value without decimal office (13)

/pivot.#/ - displays the value with 1 decimal digit (12.seven)

/pin.##/ - displays the value with ii decimal places (12.68)

LED

A elementary LED for indication. Y'all demand to ship 0 in order to turn LED off. And 255 in guild to turn LED on. Or just utilize Blynk API every bit described below:

WidgetLED              led1(V1);                              //register to virtual pin 1              led1.off(); led1.on();

All values betwixt 0 and 255 volition alter LED effulgence:

WidgetLED              led2(V2); led2.setValue(127);                              //set effulgence of LED to 50%.            

Sketch: LED

Judge

Visual display of numeric values.

Sketch: BlynkBlink

Formatting options

For instance: your sensor sends vaule of 12.6789 to Blynk application. Next formatting options are supported:

/pin/ - displays the value without formatting (12.6789)

/pin./ - displays the rounded value without decimal part (thirteen)

/pin.#/ - displays the value with ane decimal digit (12.7)

/pin.##/ - displays the value with two decimal places (12.68)

LCD

This is a regular 16x2 LCD display made in our cloak-and-dagger facility in China.

SIMPLE / ADVANCED MODE

Commands

Y'all need to use special commands with this widget:

              lcd.print(x, y, "Your Message");                          

Where x is a symbol position (0-15), y is a line id (0 or one),

Sketch: LCD Advanced Style Sketch: LCD Simple Mode Pushing Sketch: LCD Simple Mode Reading

Formatting options

For instance: your sensor sends vaule of 12.6789 to Blynk application. Next formatting options are supported:

/pivot/ - displays the value without formatting (12.6789)

/pin./ - displays the rounded value without decimal part (xiii)

/pin.#/ - displays the value with 1 decimal digit (12.vii)

/pin.##/ - displays the value with ii decimal places (12.68)

SuperChart

SuperChart is used to visualise live and historical data. You can utilise it for sensor data, for binary event logging and more.

To use SuperChart widget you lot would need to push button the information from the hardware with the desired interval by using timers.
Here is a bones example for data pushing.

Interactions:

  • Switch between fourth dimension ranges and Live manner
    Tap time ranges at the bottom of the widget to change time ranges

  • Tap Legend Elements to show or hide datastreams


  • Tap'due north'agree to view timestamp and respective values

  • Quick swipe from left to correct to reveal previous data

Then you can and so whorl data back and frontward within the given fourth dimension range.

  • Total Screen Mode
    Press this button to open Full Screen view in mural orientation:

Simply rotate the telephone back to portrait mode. Nautical chart should rotate automagically. In total screen view y'all volition see 10 (fourth dimension) and multiple Y scales. Full Screen Manner tin can be disabled from widget Settings.

  • Carte Button
    Card button will open additional functions:
    • Export to CSV
    • Erase Data on the server

SuperChart Settings:

  • Chart Title

  • Title Font Size Y'all take a pick of three font sizes

  • Title Alignment Choose nautical chart championship alignment. This setting besides affects Championship and Legend position on the Widget.

  • Show x-axis (fourth dimension) Select it if you desire to show the fourth dimension characterization at the lesser of your chart.

  • Time ranges picker Allows you to select required periods (15m, 30m, 1h, 3h, ...) and resolution for your chart. Resolution defines how precise your data is. Right now nautical chart supports two types of resolution standard and loftier. Resolution also depends on the selected menstruation. For case, standard resolution for 1d means you'll go 24 points per day (1 per hour), with high resolution you'll go for 1d 1440 points per day (1 per minute).

  • Datastreams - add datastreams (read below how to configure datastreams)

Datastream Settings

Widget supports up to 4 Datastreams. Printing Datastream Settings Icon to open Datastream Settings.

Design: Choose available types of Chart:

  • Line
  • Expanse
  • Bar
  • Binary (anchor LINK to binary)

Colour: Choose solid colors or gradients

Source and input: You lot tin utilize 3 types of Data source:

1. Virtual Pivot Choose the desired Device and Virtual Pin to read the data from.

ii. Tags SuperChart tin amass data from multiple devices using built-in aggregation functions. For example, if y'all have 10 Temperature sensors sending temperature with the given period, you can plot average value from 10 sensors on the widget.

To use Tags:

  • Add Tag to every device you desire to aggregate data from.
  • Push data to the same Virtual Pin on every device. (e.g. Blynk.virtualWrite (V0, temperature);)
  • Choose Tag every bit a source in SuperChart Widget and apply the pin where the data is coming to (e.thousand V0)

Functions available:

  • SUM, will summarize all incoming values to the specified Virtual Pivot across all devices tagged with the chosen tag
  • AVG, will plot average value
  • MED, will find a median value
  • MIN, volition plot minimum value
  • MAX will plot maximum value

☝️ Of import: Tags are not working in Alive Mode.

  1. Device Selector If you add Device Selector Widget to your project, you lot can use it every bit a source for SuperChart. In this case, when yous change the device in Device Selector, chart will be updated accordingly

Y-Axis Settings
There are 4 modes of how to calibration data forth the Y axis

  1. Car
    Data will exist auto-scaled based on min and max values of the given time menses. This is nice option to start with.

  2. Values
    When this mode is selected, Y scale will be set up to the values you choose. For example, if your hardware sends information with values varying from -100 to 100, you can set the chart to this values and data will exist rendered correctly.

You may as well want to visualize the information within some specific range. Let'due south say incoming information has values in the range of 0-55, but you lot would similar to run across but values in the range 30-50. You lot can set it upwardly and if values are out of Y scale you configured, chart will be cropped

  1. % of Height
    This pick allows yous to auto-scale incoming data on the widget and position it the way yous desire. In this mode, y'all set up the percentage of widget pinnacle on the screen, from 0% to 100%.

If you set 0-100%, in fact it'south a full auto-scale. No matter in which range the data is coming,
it volition be always scaled to the whole height of the widget.

If y'all set it to 0-25%, and so this chart will only exist rendered on 1/4 of the widget peak:

This setting is very valuable for Binary Chart or for visualizing a few datastreams on the same chart in a dissimilar mode.

  1. Delta
    While data stays inside the given Delta value, chart volition be auto-scaled within this range. If delta exceeds the range, chart will be car-scaled to min/max values of the given menses.

Suffix:
Here y'all can specify a suffix that will be shown during the Tap'due north'hold

Decimals
Defines the formatting of the graph value when you Tap'northward'hold the graph. Possible options are: #, #.#, #.##, etc.

Connect Missing Information Points
If this switch is ON, so SuperChart volition connect all the dots fifty-fifty if there was no data

If it'south set up to OFF, then you will see gaps in instance there was no data.

Binary Chart Settings
This type of chart is useful to plot binary data, for example when unit of measurement was ON or OFF, or when movement was detected or when certain threshold was reached.

You need to specify a FLIP point, which is the signal where incoming information will exist turned into TRUE or FALSE land.

For instance, yous send the data in the range of 0 to 1023. If you set 512 as a FLIP point, so everything above 512 (excluding 512) volition be recorded every bit True, any value below 512 (including 512) will be FALSE.

Another instance, if you transport 0 and 1 and prepare 0 every bit a FLIP point, and so 1 will be Truthful, 0 volition be Faux

State Labels:
Hither y'all can specify how True/FALSE should be shown in Tap'due north'Concord mode.

For case, you lot tin can set up to TRUE to "Equipment ON" label, Simulated to "Equipment OFF".

Superchart supports currently 2 types of granularity:

  • Minute granularity - 1h, 6h, 1d;
  • Hr granularity - 1w, 1m, 3m;

This means that minimum chart update interval is 1 infinitesimal for 1h, 6h, 1d periods. 1 hr for 1w, 1m and 3m periods. As Blynk Deject is gratis to use we have a limit on how many data y'all can shop. At the moment Blynk Cloud accepts 1 message per minute per pivot. In case you send your data more than frequently your values volition be averaged. For example, in case you lot transport value 10 at 12:12:05 and than again 12 at 12:12:45 as upshot in chart yous'll see value 11 for 12:12.

In order to run across data in chart yous need to use either widgets with "Frequency reading" interval (in that case your app should be open up and running) or yous can use Blynk.virtualWrite on hardware side. Every Blynk.virtualWrite command is stored on server automatically. In that instance you don't need application to exist upward and running.

Last

Displays data from your hardware. Allows to send whatsoever cord to your hardware. Terminal ever stores concluding 25 messages your hardware had ship to Blynk Deject. This limit may be increased on Local Server with terminal.strings.pool.size property.

You need to use special commands with this widget:

terminal.print();                              //                Print values, like Serial.print              terminal.println();                              //                Print values, like Serial.println()              terminal.write();                              //                Write a raw information buffer              terminal.flush();                              //                Ensure that data was sent out of device              terminal.clear();                              //                Erase all values in the concluding            

Sketch: Terminal

Video Streaming

Simple widget that allows you lot to brandish any live stream. Widget supports RTSP (RP, SDP), HTTP/S progressive streaming, HTTP/Due south live streaming. For more than info please follow official Android documentation.

At the moment Blynk doesn't provide streaming servers. So you lot can either stream directly from camera, use 3-d party services or host streaming server on own server (on raspberry for example).

You can also change video url from hardware with:

Blynk.setProperty(V1,                              "url"              ,                              "http://my_new_video_url"              );

Level Display

Level Display is very like to progress bar, when y'all need to visualize a level betwen min/max value To update Level Display from hardware side with lawmaking:

Blynk.virtualWrite(V1, val);            

Every message that hardware sends to server is stored automatically on server. Button mode doesn't require awarding to be online or opened.

Sketch: Button Instance

##Notifications ###Twitter

Twitter widget connects your Twitter account to Blynk and allows you lot to ship Tweets from your hardware.

Example code:

Blynk.tweet(                "Hey, Blynkers! My Arduino can tweet now!"              );

Limitations:

  • you cant' transport 2 tweets with same message (it'due south Twitter policy)
  • but i tweet per five seconds is immune

Sketch: Twitter

###Electronic mail

Email widget allows you to ship email from your hardware to any address.

Example code:

Blynk.email(                "my_email@case.com"              ,                              "Subject field"              ,                              "Your message goes here"              );

It also contains to field. With this field you may define receiver of email in the app. Y'all may skip to field when you want to send email to your Blynk app login email:

Blynk.email(                "Subject"              ,                              "Your bulletin goes here"              );

Y'all tin transport either text/html or text/plain (some clients don't back up text/html) email. Y'all can change this content type of electronic mail in the Mail widget settings.

Additionally you may use {DEVICE_NAME}, {DEVICE_OWNER_EMAIL} and {VENDOR_EMAIL} (for the local server) placeholders in the mail for the to, field of study and body fields:

Blynk.email(                "{DEVICE_OWNER_EMAIL}"              ,                              "{DEVICE_NAME} : Alarm"              ,                              "Your {DEVICE_NAME} has critical error!"              );

Limitations:

  • Maximum allowed email + subject field + message length is 120 symbols. However yous can increase this limit if necessary by adding #ascertain BLYNK_MAX_SENDBYTES XXX to you sketch. Where XXX is desired max length of your email. For example for ESP you tin set this to 1200 max length #ascertain BLYNK_MAX_SENDBYTES 1200. The #define BLYNK_MAX_SENDBYTES 1200 must be included before whatever of the Blynk includes.
  • Only 1 email per 5 seconds is immune
  • In case you are using gmail on the Local Server you lot are limited with 500 mails per mean solar day (by google). Other providers may have similar limitations, so delight be conscientious.
  • User is limited with 100 messages per day in the Blynk Cloud;

Sketch: Email

###Push button Notifications

Push Notification widget allows yous to send push notification from your hardware to your device. Currently information technology likewise contains two additional options:

  • Notify when hardware offline - yous volition get push notification in case your hardware went offline.
  • Offline Ignore Menses - defines how long hardware could be offline (after it went offline) earlier sending notification. In case period is exceeded - "hardware offline" notification will be ship. Yous volition get no notification in instance hardware was reconnected within specified period.
  • Priority loftier priority gives more chances that your message will be delivered without any delays. Encounter detailed explanation here.

Warning: high priority contributes more to bombardment drain compared to normal priority messages.

Instance lawmaking:

Blynk.notify(                "Hey, Blynkers! My hardware can push now!"              );

You can besides use placeholder for device proper name, that volition be replaced on the server with your device name:

Blynk.notify(                "Hey, Blynkers! My {DEVICE_NAME} can push now!"              );

Limitations:

  • Maximum immune torso length is 120 symbols;
  • Every device tin can send merely ane notification every 5 seconds;

Sketch: PushNotification

###Unicode in notify, email, button, ...

The library handles all strings every bit UTF8 Unicode. If you lot're facing problems, endeavor to print your message to the Serial and see if it works (the concluding should exist set to UTF-8 encoding). If it doesn't work, probably you lot should read about unicode support of your compiler.
If it works, but your message is truncated - yous need to increment message length limit (all Unicode symbols consume at least twice the size of Latin symbols).

###Increasing bulletin length limit

You tin can increase maximum bulletin length by putting on the top of your sketch (before Blynk includes):

#define              BLYNK_MAX_SENDBYTES              256                              //                Default is 128            

Interface

Tabs

The simply purpose of Tabs widget is to extend your projection infinite. You lot can take up to 4 tabs. Also you can elevate widgets between tabs. Just elevate widget on the label of required tab of tabs widget.

Bill of fare

Menu widget allows you lot to transport command to your hardware based on pick you fabricated on UI. Carte sends alphabetize of element y'all selected and not label cord. Sending index is starts from 1. It works same manner every bit usual ComboBox element. You lot tin can as well set Card items from hardware side.

Example lawmaking:

              switch (param.asInt())   {     case 1: { // Particular 1       Serial.println("Detail 1 selected");       break;     }     case 2: { // Item 2       Serial.println("Item 2 selected");       interruption;     }       }                          

Sketch: Card

Time Input

Time input widget allows you to select start/stop time, solar day of calendar week, timezone, sunrise/sunset formatted values and send them to your hardware. Supported formats for time now are HH:MM and HH:MM AM/PM.

Hardware volition get selected on UI time as seconds of day (3600 * hours + 60 * minutes) for start/stop time. Time that widget sends to hardware is user local time. Selected days indexes:

              Monday - 1 Tuesday - ii ... Saturday - half-dozen Sundays - 7                          

Y'all can also alter state of widget on UI. Run across below sketches.

Sketch: Simple Time Input for start time

Sketch: Advanced Fourth dimension Input

Sketch: Update Fourth dimension Input Country on UI

Map

Map widget allows you prepare points/pins on map from hardware side. This is very useful widget in case you lot have multiple devices and yous want track their values on map.

You can transport a indicate to map with regular virtual wrtei control:

Blynk.virtualWrite(V1, pointIndex, lat, lon,                              "value"              );

We also created wrapper for you to brand suage of map simpler:

You can modify button labels from hardware with:

WidgetMap              myMap(V1); ...              int              index =              1;              float              lat =              51.5074;              float              lon =              0.1278; myMap.location(index, lat, lon,                              "value"              );

Using save index allows you to override existing point value.

Sketch: Bones Sketch

Table

Table widget comes handy when yous need to structure like information within 1 graphical chemical element. Information technology works as a usual table.

You lot tin add a row to the table with:

              Blynk.virtualWrite(V1, "add together", id, "Name", "Value");                          

You tin update a row in the table with:

              Blynk.virtualWrite(V1, "update", id, "UpdatedName", "UpdatedValue");                          

To highlight any item in a tabular array by using it's id in a tabular array:

              Blynk.virtualWrite(V1, "pick", 0);                          

To select/deselect (brand icon green/gray) item in a tabular array by using it's row id in a table:

              Blynk.virtualWrite(V1, "select", 0); Blynk.virtualWrite(V1, "deselect", 0);                          

To clear the tabular array at any time with:

              Blynk.virtualWrite(V1, "clr");                          

You tin can also handle other deportment coming from table. For example, use row every bit a switch button.

              BLYNK_WRITE(V1) {    String cmd = param[0].asStr();    if (cmd == "select") {        //row in table was selected.         int rowId = param[1].asInt();    }    if (cmd == "deselect") {        //row in table was deselected.         int rowId = param[1].asInt();    }    if (cmd == "guild") {        //rows in table where reodered        int oldRowIndex = param[i].asInt();        int newRowIndex = param[2].asInt();    } }                          

Notation: Max number of rows in the table is 100. When yous reach the limit, tabular array will work equally FIFO (First In First Out) list. This limit can exist changed by configuring tabular array.rows.pool.size belongings for Local Server.

Sketch: Uncomplicated Table usage

Sketch: Advanced Table usage

Device Selector

Device selector is a powerful widget which allows you to update widgets based on ane active device. This widget is particlularly helpful when you have a fleet of devices with like functionality.

Imagine you lot have 4 devices and every device has a Temperature & Humidity sensor connected to it. To display the data for all 4 devices you lot would need to add viii widgets.

With Device Selector, you can apply merely 2 Widgets which will display Temperature and Humidity based on the active device called in Device Selector.

All you have to do is:

  1. Add Device Selector Widget to the project
  2. Add together two widgets (for example Value Display Widget) to show Temperature and Humidity
  3. In Widgets Settings you will exist able assign them to Device Selector (Source or Target department)
  4. Exit settings, Run the projection.

Now you can change the active device in Device Selector and you lot will see that Temperature and Humidity values are reflecting the data updates for the device you but picked.

Notation: Webhook Widget will non work with Device Selector (yet).

Device Tiles

Device tiles is a powerful widget and very similar to the device selector widget, but with UI. Information technology allows you to brandish 1 pivot per device per tile. This widget is particularly helpful when you have a fleet of devices with similar functionality. So you can group similar devices within 1 layout (template).

Sensors

Accelerometer

Accelerometer is kind of motion sensors that allows you lot to notice movement of your smartphone. Useful for monitoring device movement, such as tilt, shake, rotation, or swing. Conceptually, an dispatch sensor determines the acceleration that is applied to a device by measuring the forces that are applied to the sensor. Measured in yard/southward^2 applied to ten, y, z axis.

In order to take data from it you need to:

              BLYNK_WRITE(V1) {                              //dispatch force practical to axis x              int              x = param[0].asFloat();                              //dispatch forcefulness applied to axis y              int              y = param[ane].asFloat();                              //acceleration forcefulness applied to axis y              int              z = param[ii].asFloat(); }

Accelerometer doesn't work in background.

Barometer/pressure

Barometer/pressure level is kind of environs sensors that allows yous to mensurate the ambient air pressure.

Measured in in hPa or mbar.

In oder to take data from it you lot demand to:

              BLYNK_WRITE(V1) {                              //pressure level in mbar              int              pressure = param[0].asInt();  }

Barometer doesn't work in background.

Gravity

Gravity is kind of motion sensors that allows you lot to discover move of your smartphone. Useful for monitoring device movement, such as tilt, milk shake, rotation, or swing.

The gravity sensor provides a 3 dimensional vector indicating the direction and magnitude of gravity. Measured in m/s^2 of gravity force practical to ten, y, z axis.

In oder to have data from information technology you lot need to:

              BLYNK_WRITE(V1) {                              //force of gravity applied to centrality x              int              x = param[0].asFloat();                              //force of gravity applied to axis y              int              y = param[one].asFloat();                              //force of gravity practical to axis y              int              z = param[2].asFloat(); }

Gravity doesn't work in groundwork.

Humidity

Humidity is kind of surroundings sensors that allows you to measure ambient relative humidity.

Measured in % - actual relative humidity in percent.

In oder to accept data from it you need to:

              BLYNK_WRITE(V1) {                              //                humidity in %              int              humidity = param.asInt(); }

Humidity doesn't work in groundwork.

Calorie-free

Low-cal is kind of environment sensors that allows you to mensurate level of light (measures the ambient light level (illumination) in threescore). In phones it is used to command screen brightness.

In order to take information from it you need to:

              BLYNK_WRITE(V1) {                              //light value              int              lx = param.asInt();  }

Lite doesn't work in groundwork.

Proximity

Proximity is kind of position sensors that allows you to determine how shut the face up of a smartphone is to an object. Measured in cm - distance from phone confront to object. Nonetheless most of this sensors returns just FAR / Almost information. So render value will be 0/1. Where 0/Depression is FAR and one/HIGH is NEAR.

In social club to take information from it you need to:

              BLYNK_WRITE(V1) {                              //                altitude to object              int              proximity = param.asInt();              if              (proximity) {                              //NEAR              }              else              {                              //FAR              } }

Proximity doesn't work in background.

Temperature

Temperature is kind of environment sensors that allows you to measure ambient air temperature. Measured in °C - celcius.

In order to take data from information technology you need to:

              BLYNK_WRITE(V1) {                              //                temperature in celcius              int              celcius = param.asInt(); }

Temperature doesn't work in groundwork.

GPS Trigger

GPS trigger widget allows easily trigger events when yous arrive to or get out from some destination. This widget volition piece of work in groundwork and periodically will check your coordinates. In instance your location is within/out required radius (selected on widget map) widget will ship HIGH/Low control to hardware. For example, let's assume you have GPS Trigger widget assigned to pivot V1 and pick Trigger When Enter. In that instance when you'll arrive to destination point widget will trigger HIGH effect.

              BLYNK_WRITE(V1) {              int              country = param.asInt();              if              (land) {                              //You lot enter destination              }              else              {                              //You exit destination              } }

More details on how GPS widget works you lot can read here.

GPS trigger widget works in background.

GPS Streaming

Useful for monitoring smartphone location data such as latitude, longitude, altitude and speed (speed could be often 0
in example smartphone doesn't support information technology).

In order to take information from this widget you demand to:

              BLYNK_WRITE(V1) {              float              latitude = param[0].asFloat();              float              longitude = param[one].asFloat();              float              distance = param[2].asFloat();              float              speed = param[3].asFloat(); }

or you can apply prepared wrapper GpsParam:

              BLYNK_WRITE(V1) {   GpsParam              gps(param);                              //                Print six decimal places for Lat              Serial.println(gps.getLat(),              7);   Series.println(gps.getLon(),              7);      Serial.println(gps.getAltitude(),              2);   Series.println(gps.getSpeed(),              2); }

GPS Streaming works in background.

Sketch: GPS Stream

Other

Span

Bridge can be used for Device-to-Device communication (no app. involved). You can send digital/analog/virtual write commands from one device to some other, knowing it's auth token. At the moment Bridge widget is not required on application side (information technology is mostly used for indication that we have such feature).
You can use multiple bridges to control multiple devices.

Bridge widget takes a virtual pin, and turns it into a channel to command another device. Information technology means you can command whatsoever virtual, digital or analog pins of the target device. Be conscientious non to employ pins like A0, A1, A2 ... when communicating between different device types, every bit Arduino Cadre may refer to wrong pins in such cases.

Example code for device A which will send values to device B:

WidgetBridge              bridge1(V1);                              //Initiating Bridge Widget on V1 of Device A              ...              void              setup() {     Blynk.begin(...);              while              (Blynk.connect() ==              false) {                              //                Wait until Blynk is connected              }     bridge1.digitalWrite(9, HIGH);                              //                will trigger D9 HIGH on Device B. No code on Device B required              bridge1.analogWrite(10,              123);     bridge1.virtualWrite(V1,                              "hello"              );                              //                you need to write code on Device B in club to receive this value. See below              bridge1.virtualWrite(V2,                              "value1"              ,                              "value2"              ,                              "value3"              ); }              BLYNK_CONNECTED() {   bridge1.setAuthToken(                "OtherAuthToken"              );                              //                Token of the hardware B              }

Important: when performing virtualWrite() with Span Widget, Device B would need to procedure the incoming data from Device A. For example, if you are sending value from Device A to Device B using bridge.virtualWrite(V5) you lot would demand to use this handler on Device B:

              BLYNK_WRITE(V5){              int              pinData = param.asInt();                              //pinData variable will store value that came via Bridge              }

Keep in mind that bridge.virtualWrite doesn't send any value to mobile app. You demand to call Blynk.virtualWrite for that.

Sketch: Bridge

Eventor

Eventor widget allows you lot to create simple behaviour rules or events. Let's look at a typical use instance: read temperature from DHT sensor and ship push notification when the temperature is over a certain limit:

              bladder              t = dht.readTemperature();              if              (isnan(t)) {              return;   }              if              (t >              40) {     Blynk.notify(String(                "Temperature is too high:                "              ) + t);   }

With Eventor you don't need to write this code. All you lot need is to send the value from the sensor to the server:

              float              t = dht.readTemperature();   Blynk.virtualWrite(V0, t);

Don't forget that virtualWrite commands should be wrapped in the timer and tin can't exist used in the primary loop.

At present configure new Consequence in Eventor widget:

Notation Don't forget to add notification widget.

Eventor comes handy when you need to change conditions on the fly without re-uploading new sketch on the hardware. Yous tin can create as many events as you need. Eventor likewise could be triggered from the application side. You just need to assign the widget to the aforementioned pin every bit your Upshot inside Eventor. Eventor doesn't constantly sends events. Let'south consider simple event as to a higher place if (temperature > forty) send notification . When temperature goes beyond 40 threshold - notification action is triggered. If temperature continues to stay higher up the 40 threshold no actions volition be triggered. But if temperature goes below threshold and then passes it again - notification will be sent once again (there is no 5 sec limit on Eventor notifications).

Eventor besides supports Timer events. For instance, you can set a pin V1 ON/High at 21:00:00 every Friday. With Eventor Time Event you tin assign multiple timers on same pin, send any cord/number, select days and timezone.

In order to remove created consequence please use swipe. You can also swipe out last element in the Outcome itself.

Note: The timer widget rely on the server fourth dimension and not your phone time. Sometimes the phone time may not friction match the server fourth dimension. Notation: Events are triggered simply one time when the condition is met. That's mean chaining of events is not possible (notwithstanding, could be enabled for commercials).

Sketch: Eventor

Annotation:: Events are triggered only once when the condition is met. Exception: Let's consider simple consequence as above if (temperature > forty) ship notification . When temperature goes beyond xl threshold - notification action is triggered. If temperature continues to stay to a higher place the 40 threshold no actions volition be triggered. But if temperature goes below threshold and and then passes it once again - notification will be sent again (there is no 5 sec limit on Eventor notifications).

RTC

Real-time clock allows you to go fourth dimension from server. Yous can preselect whatsoever timezone on UI to get time on hardware in required locale. No pivot required for RTC widget.

Sketch: RTC

BLE

Widget to enable Bluetooth Low Energy support. At the moment BLE widget requires internet connectedness in club to login and load your profile. Notwithstanding this volition exist fixed soon. Also some Blynk widgets are not supported inside the BLE connection.

Blynk currently supports a handful of different BLE modules. Delight check sketches below.

Sketches: BLE

Bluetooth

Widget to enable Bluetooth support. At the moment Bluetooth widget is supported only on Android and requires internet connection to login and to load your contour. This will exist fixed soon. Alsom some Blynk widgets exercise non work within the Bluetooth connection.

Blynk currently supports bunch of different modules. Delight check sketches below.

Sketches: Bluetooth

Music Actor

Uncomplicated UI element with iii buttons with common music histrion controls. Every button sends it'due south own command to hardware: play, stop, prev, next.

You tin can change widget state within the app from hardware side with next commands:

              Blynk.virtualWrite(Vx, "play"); Blynk.virtualWrite(Vx, "terminate");                          

You lot can too change widget play/terminate state with next lawmaking (equivalent to above commands):

Blynk.setProperty(V1, "isOnPlay", "imitation");

Sketch: Music Player

Webhook

Webhook is a widget designed to communicate with 3rd political party services. With Webhook widget y'all tin can send HTTP(Due south) requests to whatever 3rd party service or device that has HTTP(S) API (e.g. Philips Hue bulb). You lot tin trigger iii-d party service with a single click of a push.

Any write performance from hardware side will trigger Webhook Widget. You can also trigger webhook from Blynk app when a app widget is assigned to the aforementioned pin as Webhook.

For case, when you lot need to send data from your hardware not but to Blynk, only also to Thingspeak, you would need to write a long http request lawmaking similar this (this is just an example, not a full sketch):

              WiFiClient customer; if (client.connect("api.thingspeak.com", 80)) {     customer.print("Mail /update HTTP/1.ane\due north");     client.print("Host: api.thingspeak.com\north");     customer.print("Connectedness: close\n");     customer.print("X-THINGSPEAKAPIKEY: " + apiKeyThingspeak1 + "\north");     client.impress("Content-Type: application/x-www-grade-urlencoded\n");     customer.print("Content-Length: ");     customer.print(postStr.length());     client.impress("\north\n");     client.impress(postStr); }                          

Instead, with Webhook widget you would only need to fill up in these fields:

And add together this code on hardware side:

              Blynk.virtualWrite(V0, value);                          

where V0 is pivot assigned to the Webhook widget.

Utilise standard Blynk placeholders for Pivot Value in the trunk or URL, for case:

              https://api.thingspeak.com/update?api_key=xxxxxx&field1=/pin/                          

or for the body

When yous need to send an array of values, you tin can refer to a specific alphabetize of the array value. Blynk Pivot can hold an assortment of max x values:

/pin[0]/,/pivot[1]/, /pivot[2]/

You lot can also brand GET requests from Blynk Server and get responses straight to your hardware.

For instance, to go current weather from a third party Weather service that uses an URL similar to this: http://api.sunrise-dusk.org/json?lat=33.3823&lng=35.1856&date=2016-10-01, you would demand to put this URL in Webhook widget and assign it to V0 pin.

To parse the response on the hardware side:

              BLYNK_WRITE(V0){   String webhookdata = param.asStr();   Serial.println(webhookdata); }                          

Now, every time there is a "write" control to V0 pivot (e.g. with Blynk.virtualWrite(V0, 1) from hardware or from app widget assigned to V0), BLYNK_WRITE(V0) construction will be triggered and processed.

Notation: Normally, 3rd party servers return long responses. You have to increase the maximum allowed message size your hardware can process. Modify this line in your firmware code:

#define BLYNK_MAX_READBYTES 1024. Where 1024 - is maximum allowed bulletin size.

NOTE: Blynk Cloud has limitation for Webhook Widget - yous can simply send 1 request per second. This tin can exist changed on a Local Server by changing webhooks.frequency.user.quota.limit. Be careful with Webhooks, equally many 3rd party services can't handle 1 req/sec, and you tin exist banned on some of them. For instance, Thingspeak allows merely ane request per 15 seconds.

NOTE: To avoid spamming, Blynk Webhook feature has another limitation - if your Webhook requests fail x times in a row, Webhook Widget will be stopped. To resume it, you would need to open up Widget Settings and re-relieve it. Failed request is a request that doesn't return 200 or 302.

NOTE: Webhook widget may affect Blynk.syncAll() role when a returned response is large.

Reports Widget

Office of Reports is to configure and customize data reports in CSV format. You can choose between one-time or continuous scheduled reports.

Also, within the Reports you tin articulate all the data collected by your devices.

Yous need to configure initial inputs in Edit manner, so, in Play mode you will be able to customize reports.

Edit mode. Data inputs configuration

In edit mode (when your project is stopped) you define the Datastreams you would like to afterwards exist included in reports. Reports widget is designed to work with the Device Tiles widget. If you don't use Device Tiles yous tin nevertheless select a single device or a group of devices as a source of information for reports.

You lot have to cull either Device Tiles or unmarried / group of the devices for the report. You lot tin't combine these ii options.

Play fashion.

After you added source devices and their Datastreams click Play button and click on the Reports push button.

Customizing Reports.

Every Report option supposes it'due south own settings:

Report proper noun - requite your study a meaningful proper noun.

Data source - select the Datastreams yous would similar to exist included in reports.

Report Frequency - Defines how ofttimes reports will be sent. They can be one-time and scheduled. i-time - will instantly generate report and send it to the email addresses specified. Click on the right icon to send information technology.

Scheduled reports tin be sent daily/weekly/monthly.

At Time will gear up a fourth dimension of the mean solar day the report will be sent. Start/End specifies start and terminate date the reports volition proceed to be sent.

For Weekly Report yous can select a 24-hour interval of the calendar week when report should exist sent. For Monthly study you lot can choose whether to send report on the first or last day of the month.

Recipients - specify up to 5 email addresses.

Data resolution defines granularity of your reports. Supported granularities are: infinitesimal, hourly and daily. For instance, when you generate daily study with one minute granularity y'all'll get 24 * lx * 60 points in your daily report for every selected Datastream.

Group data in reports by - specify the output format of the CSV file(southward).

Datastream you will get 1 CSV file for each Datastream.

Device you lot volition get 1 CSV file per each device. Each file volition incorporate all of the included Datastreams.

Report you will become one CSV file for all your devices and all your Datastreams.

Timezone correction - specify the fourth dimension zone adjustment if yous need to get written report date and fourth dimension adjusted to a specific time zone

Date and fourth dimension format - defines the format of the timestamp field of your data. You can select 2018-06-21 20:sixteen:48, 2018-06-21T20:16:48+03:00 or other supported formats.

There is 1 specific Timestamp format - which reflects the difference between the current fourth dimension and midnight, January one, 1970 UTC measured in milliseconds.

After the study is set up up - click on "OK" button at the right upper corner. Your report is ready.

In one case you configured the report yous volition run across when is the Next study scheduled and besides a schedule for this report.

Afterward the report was sent at least once, you can see when the Terminal report was sent.

Last label also contains the status regarding the study:

  • OK: the report was generated and sent to the Recipients successfully;
  • No Data: the written report doesn't contain any information for the configured catamenia;
  • Error: something went incorrect. Please contact the Blynk Team back up;

Reports will be generated even if your project is non in agile (Play) mode. However, inactive projects don't generate whatever data.

NOTE: all reports are encoded in UTF-xvi. Please, make certain yous selected UTF-xvi every bit required "Character set" for your csv reader.

duryeacamuctued96.blogspot.com

Source: https://github.com/blynkkk/blynkkk.github.io/blob/master/Widgets.md