Академический Документы
Профессиональный Документы
Культура Документы
cc/
1 de 45 21/04/2016 20:23
http://docs.blynk.cc/
2 de 45 21/04/2016 20:23
http://docs.blynk.cc/
3 de 45 21/04/2016 20:23
http://docs.blynk.cc/
4 de 45 21/04/2016 20:23
http://docs.blynk.cc/
5 de 45 21/04/2016 20:23
http://docs.blynk.cc/
6 de 45 21/04/2016 20:23
http://docs.blynk.cc/
void setup()
{
Serial.begin(9600); // See the connection status in Serial Monitor
Blynk.begin(auth); // Here your Arduino connects to the Blynk Cloud.
}
void loop()
{
Blynk.run(); // All the Blynk Magic happens here...
}
Blynk v.X.X.X
Your IP is 192.168.0.11
Connecting...
Blynk connected!
7 de 45 21/04/2016 20:23
http://docs.blynk.cc/
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(2, 3); // RX, TX
#define BLYNK_PRINT SwSerial
#include <BlynkSimpleSerial.h>
void setup()
{
SwSerial.begin(9600);
Blynk.begin(auth);
// Default baud rate is 9600. You could specify it like this:
//Blynk.begin(auth, 57600);
}
void loop()
{
Blynk.run();
}
/scripts
8 de 45 21/04/2016 20:23
http://docs.blynk.cc/
cd User$/Documents/Arduino/libraries/Blynk/scripts
sudo
/dev/tty.usbmodem1451
```
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install build-essential
sudo npm install -g npm
sudo npm install -g onoff
sudo npm install -g blynk-library
```
9 de 45 21/04/2016 20:23
http://docs.blynk.cc/
/etc/rc.local
01_PARTICLE.INO
10 de 45 21/04/2016 20:23
http://docs.blynk.cc/
Blynk.virtualWrite(pin, "abc");
Blynk.virtualWrite(pin, 123);
Blynk.virtualWrite(pin, 12.34);
Blynk.virtualWrite(pin, "hello", 123, 12.34);
1 0
11 de 45 21/04/2016 20:23
http://docs.blynk.cc/
BLYNK_READ(V5) // Widget in the app READs Virtal Pin V5 with the certain frequency
{
// This command writes Arduino's uptime in seconds to Virtual Pin V5
Blynk.virtualWrite(5, millis() / 1000);
12 de 45 21/04/2016 20:23
http://docs.blynk.cc/
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <SimpleTimer.h> // here is the SimpleTimer library
void setup()
{
Serial.begin(9600);
Blynk.begin(auth);
timer.setInterval(1000L, sendUptime); // Here you set interval (1sec) and which function to
}
void sendUptime()
{
// This function sends Arduino up time every 1 second to Virtual Pin (V5)
// In the app, Widget's reading frequency should be set to PUSH
// You can send anything with any interval using this construction
// Don't send more that 10 values per second
void loop()
{
Blynk.run(); // all the Blynk magic happens here
timer.run(); // SimpleTimer is working
}
13 de 45 21/04/2016 20:23
http://docs.blynk.cc/
BLYNK_CONNECTED() {
if (isFirstConnect) {
Blynk.syncAll();
}
}
Blynk.syncAll()
Blynk.syncVirtual(pin)
Blynk.virtualWrite
Blynk.virtualWrite(V1, HIGH)
delay()
14 de 45 21/04/2016 20:23
http://docs.blynk.cc/
15 de 45 21/04/2016 20:23
http://docs.blynk.cc/
digitalWrite(3, value);
digitalWrite(4, value);
16 de 45 21/04/2016 20:23
http://docs.blynk.cc/
17 de 45 21/04/2016 20:23
http://docs.blynk.cc/
18 de 45 21/04/2016 20:23
http://docs.blynk.cc/
/pin/
/pin./
/pin.#/
/pin.##/
19 de 45 21/04/2016 20:23
http://docs.blynk.cc/
WidgetLED led2(2);
led2.setValue(127); //set brightness of LED to 50%.
20 de 45 21/04/2016 20:23
http://docs.blynk.cc/
lcd.clear();
/pin/
21 de 45 21/04/2016 20:23
http://docs.blynk.cc/
/pin.##/
6h
1w
3m
1h 6h 1d
1w 1m 3m
22 de 45 21/04/2016 20:23
http://docs.blynk.cc/
terminal.print();
terminal.flush();
23 de 45 21/04/2016 20:23
http://docs.blynk.cc/
24 de 45 21/04/2016 20:23
http://docs.blynk.cc/
25 de 45 21/04/2016 20:23
http://docs.blynk.cc/
switch (param.asInt())
{
case 1: { // Item 1
Serial.println("Item 1 selected");
break;
}
case 2: { // Item 2
Serial.println("Item 2 selected");
break;
}
}
26 de 45 21/04/2016 20:23
http://docs.blynk.cc/
BLYNK_CONNECTED() {
bridge1.setAuthToken("OtherAuthToken");
}
27 de 45 21/04/2016 20:23
http://docs.blynk.cc/
28 de 45 21/04/2016 20:23
http://docs.blynk.cc/
29 de 45 21/04/2016 20:23
http://docs.blynk.cc/
30 de 45 21/04/2016 20:23
http://docs.blynk.cc/
31 de 45 21/04/2016 20:23
http://docs.blynk.cc/
Connected to blynk-cloud.com.
delay() loop()
void loop()
{
...
delay(1000); // this is long delay, that should be avoided
other_long_operation();
...
Blynk.run();
}
32 de 45 21/04/2016 20:23
http://docs.blynk.cc/
void loop()
{
Blynk.virtualWrite(1, value); // This line sends hundreds of messages to Blynk server
Blynk.run();
}
delay()
void setup()
Serial.begin(9600);
./blynk-ser.sh -f SSL
--cert
33 de 45 21/04/2016 20:23
http://docs.blynk.cc/
-f SSL
./blynk-ser.sh -t TCP
34 de 45 21/04/2016 20:23
http://docs.blynk.cc/
java -version
Output: java version "1.8.0_40"
.jar
cd Users/User/Blynk/Server
./logs/blynk.log
java -version
Output: java version "1.8.0_40"
wget "https://github.com/blynkkk/blynk-server/releases/download/v0.15.3/server-0.15.3.jar"
./logs
/blynk.log file.
crontab -e
35 de 45 21/04/2016 20:23
http://docs.blynk.cc/
username 10539 1.0 12.1 3325808 428948 pts/76 Sl Jan22 9:11 java -jar server-0.15.3.j
kill 10539
Blynk.begin(auth);
36 de 45 21/04/2016 20:23
http://docs.blynk.cc/
blynk-ser.sh -s
./blynk-ser.sh -s you_host_or_IP
app.ssl.port=8443
server.ssl.cert=./server_embedded.crt
server.ssl.key=./server_embedded.pem
server.ssl.key.pass=pupkin123
hardware.default.port=8442
https.port=7443
http.port=8080
data.folder=/tmp/blynk
logs.folder=./logs
log.level=trace
user.dashboard.max.limit=10
37 de 45 21/04/2016 20:23
http://docs.blynk.cc/
user.message.quota.limit.exceeded.warning.period=60000
user.profile.max.size=128
notifications.queue.limit=10000
profile.save.worker.period=60000
app.socket.idle.timeout=600
hard.socket.idle.timeout=15
enable.raw.data.store=true
https://your_ip:7443/admin
admin.rootPath=/admin
38 de 45 21/04/2016 20:23
http://docs.blynk.cc/
allowed.users.list=allowed1@gmail.com,allowed2@gmail.com
mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.smtp.host=smtp.gmail.com
mail.smtp.port=587
mail.smtp.username=YOUR_EMAIL_HERE
mail.smtp.password=YOUR_EMAIL_PASS_HERE
Blynk.virtualWrite()
dashBoardId_pin.csv
data/1_v5.csv
value,timestamp
10,1438022081332
39 de 45 21/04/2016 20:23
http://docs.blynk.cc/
openssl x509 -req -days 1825 -in server.csr -signkey server.key -out server.crt
openssl pkcs8 -topk8 -inform PEM -outform PEM -in server.key -out server.pem
Blynk.begin()
Blynk.begin(auth, ...);
Blynk.config(auth);
connectWiFi
Blynk.connectWiFi(ssid, pass)
40 de 45 21/04/2016 20:23
http://docs.blynk.cc/
# This functions will keep connecting to Blynk server. Default timeout is 30 seconds
bool result = Blynk.connect();
bool result = Blynk.connect(timeout);
Blynk.disconnect();
Blynk.begin(...) Blynk.config(...)
Blynk.run() Blynk.connect()
Blynk.disconnect()
void loop() {}
Blynk.run()
BLYNK_READ BLYNK_WRITE
digitalRead
digitalWrite
analogRead
analogWrite (PWM or Analog signal depending on the platform)
Blynk.virtualWrite(pin, value)
BLYNK_WRITE(vPIN)
param.asInt();
param.asFloat();
param.asDouble();
param.asStr();
41 de 45 21/04/2016 20:23
http://docs.blynk.cc/
param.getBuffer()
param.getLength()
// Send string
Blynk.virtualWrite(pin, "abc");
// Send integer
Blynk.virtualWrite(pin, 123);
// Send float
Blynk.virtualWrite(pin, 12.34);
virtualWrite
BLYNK_WRITE
BLYNK_WRITE(V0)
{
int value = param.asInt(); // Get value as integer
BLYNK_READ
Blynk.virtualWrite
BLYNK_READ(V0)
{
Blynk.virtualWrite(v0, newValue);
}
BLYNK_WRITE
BLYNK_WRITE_DEFAULT()
{
int pin = request.pin; // Which exactly pin is handled?
int value = param.asInt(); // Use param as usual.
}
BLYNK_WRITE
BLYNK_READ_DEFAULT()
42 de 45 21/04/2016 20:23
http://docs.blynk.cc/
BLYNK_CONNECTED() {
// Your code here
}
BLYNK_CONNECTED() {
if (isFirstConnect) {
Blynk.syncAll();
}
}
BLYNK_WRITE
Blynk.syncVirtual(V0);
#define BLYNK_PRINT Serial // Defines the object that is used for printing
#define BLYNK_DEBUG // Optional, this enables more detailed prints
Serial.begin(9600);
BLYNK_DEBUG
BLYNK_PRINT BLYNK_LOG
printf
43 de 45 21/04/2016 20:23
http://docs.blynk.cc/
44 de 45 21/04/2016 20:23
http://docs.blynk.cc/
45 de 45 21/04/2016 20:23