* AM2321的取温度间隔得大于2s,否则,i2c会不工作了 * SimpleTimer有个bug,会导致两次快速的读温度,现在读温度函数里加了保护 * Blynk有个bug,会导致无法把数据传到服务器 * 现在可以正常工作了

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

BlynkApi< Proto > Class Template Reference

BlynkApi< Proto > Class Template Reference

Represents high-level functions of Blynk. More...

#include <BlynkApi.h>

Public Member Functions

bool connect (unsigned long timeout=BLYNK_TIMEOUT_MS *3)
 Connects to the server.
void disconnect ()
 Disconnects from the server.
bool connected ()
bool run (bool available=false)
 Performs Blynk-related housekeeping and processes incoming commands.
template<typename T >
void virtualWrite (int pin, const T &data)
 Sends value to a Virtual Pin.
void virtualWriteBinary (int pin, const void *buff, size_t len)
 Sends buffer to a Virtual Pin.
void virtualWrite (int pin, const BlynkParam &param)
 Sends BlynkParam to a Virtual Pin.
void syncAll ()
 Requests Server to re-send current values for all widgets.
void syncVirtual (int pin)
 Requests App or Server to re-send current value of a Virtual Pin.
template<typename T >
void tweet (const T &msg)
 Tweets a message.
template<typename T >
void notify (const T &msg)
 Sends a push notification to the App.
template<typename T >
void sms (const T &msg)
 Sends an SMS.
template<typename T1 , typename T2 >
void email (const char *email, const T1 &subject, const T2 &msg)
 Sends an email message.
template<typename T1 , typename T2 >
void email (const T1 &subject, const T2 &msg)
 Sends an email message.
void refresh (int pin)
 Refreshes value of a widget by running user-defined BLYNK_READ handler of a pin.
void delay (unsigned long ms)
 Delays for N milliseconds, handling server communication in background.

Detailed Description

template<class Proto>
class BlynkApi< Proto >

Represents high-level functions of Blynk.

Definition at line 24 of file BlynkApi.h.


Member Function Documentation

bool connect ( unsigned long  timeout = BLYNK_TIMEOUT_MS *3 )

Connects to the server.

Blocks until connected or timeout happens. May take less or more then timeout value.

Parameters:
timeoutConnection timeout
Returns:
True if connected to the server
bool connected (  )
Returns:
True if connected to the server
void delay ( unsigned long  ms )

Delays for N milliseconds, handling server communication in background.

Warning:
Should be used very carefully, especially on platforms with small RAM.
Parameters:
msMilliseconds to wait

Definition at line 262 of file BlynkApi.h.

void disconnect (  )

Disconnects from the server.

It will not try to reconnect, until connect() is called

void email ( const T1 &  subject,
const T2 &  msg 
)

Sends an email message.

Parameters:
subjectSubject of message
msgText of the message

Definition at line 227 of file BlynkApi.h.

void email ( const char *  email,
const T1 &  subject,
const T2 &  msg 
)

Sends an email message.

Parameters:
emailEmail to send to
subjectSubject of message
msgText of the message

Definition at line 211 of file BlynkApi.h.

void notify ( const T &  msg )

Sends a push notification to the App.

Parameters:
msgText of the message

Definition at line 183 of file BlynkApi.h.

void refresh ( int  pin )

Refreshes value of a widget by running user-defined BLYNK_READ handler of a pin.

Parameters:
pinVirtual Pin number

Definition at line 247 of file BlynkApi.h.

bool run ( bool  available = false )

Performs Blynk-related housekeeping and processes incoming commands.

Parameters:
availableTrue if there is incoming data to process Only used when user manages connection manually.
void sms ( const T &  msg )

Sends an SMS.

Parameters:
msgText of the message

Definition at line 196 of file BlynkApi.h.

void syncAll (  )

Requests Server to re-send current values for all widgets.

Definition at line 146 of file BlynkApi.h.

void syncVirtual ( int  pin )

Requests App or Server to re-send current value of a Virtual Pin.

This will probably cause user-defined BLYNK_WRITE handler to be called.

Parameters:
pinVirtual Pin number

Definition at line 156 of file BlynkApi.h.

void tweet ( const T &  msg )

Tweets a message.

Parameters:
msgText of the message

Definition at line 170 of file BlynkApi.h.

void virtualWrite ( int  pin,
const T &  data 
)

Sends value to a Virtual Pin.

Parameters:
pinVirtual Pin number
dataValue to be sent

Definition at line 72 of file BlynkApi.h.

void virtualWrite ( int  pin,
const BlynkParam &  param 
)

Sends BlynkParam to a Virtual Pin.

Parameters:
pinVirtual Pin number
param

Definition at line 139 of file BlynkApi.h.

void virtualWriteBinary ( int  pin,
const void *  buff,
size_t  len 
)

Sends buffer to a Virtual Pin.

Parameters:
pinVirtual Pin number
buffData buffer
lenLength of data

Definition at line 125 of file BlynkApi.h.