初始化提交

This commit is contained in:
王立帮
2024-07-20 22:09:06 +08:00
commit c247dd07a6
6876 changed files with 2743096 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use Adafruit Bluefruit LE nRF8001 breakout
to connect your project to Blynk.
Note: This requires BLEPeripheral library
from http://librarymanager/all#BLEPeripheral
or https://github.com/sandeepmistry/arduino-BLEPeripheral
NOTE: BLE support is in beta!
*************************************************************/
#define BLYNK_USE_DIRECT_CONNECT
#define BLYNK_PRINT Serial
#include <BlynkSimpleBLEPeripheral.h>
#include <BLEPeripheral.h>
#include <SPI.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
// Define pins (varies per shield/board)
#define BLE_REQ 10
#define BLE_RDY 2
#define BLE_RST 9
// Create ble serial instance, see pinouts above
BLESerial SerialBLE(BLE_REQ, BLE_RDY, BLE_RST);
void setup() {
Serial.begin(9600);
SerialBLE.setLocalName("Blynk");
SerialBLE.setDeviceName("Blynk");
SerialBLE.setAppearance(0x0080);
SerialBLE.begin();
Serial.println("Waiting for connections...");
Blynk.begin(SerialBLE, auth);
}
void loop() {
SerialBLE.poll();
if (SerialBLE) { // If BLE is connected...
Blynk.run();
}
}

View File

@@ -0,0 +1,66 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use Adafruit Feather 32u4 BLE
to connect your project to Blynk.
Note: This requires BluefruitLE nRF51 library
from http://librarymanager/all#Adafruit_BluefruitLE_nRF51
or https://github.com/adafruit/Adafruit_BluefruitLE_nRF51
NOTE: BLE support is in beta!
*************************************************************/
#define BLYNK_USE_DIRECT_CONNECT
#define BLYNK_PRINT Serial
#include <BlynkSimpleSerialBLE.h>
#include <Adafruit_BLE.h>
#include <Adafruit_BluefruitLE_SPI.h>
#include <SPI.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
// SHARED SPI SETTINGS (see adafruit webpages for details)
#define BLUEFRUIT_SPI_CS 8
#define BLUEFRUIT_SPI_IRQ 7
#define BLUEFRUIT_SPI_RST 4 // Optional but recommended, set to -1 if unused
#define BLUEFRUIT_VERBOSE_MODE true
// Create ble instance, see pinouts above
Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);
void setup() {
Serial.begin(9600);
ble.begin(BLUEFRUIT_VERBOSE_MODE);
ble.factoryReset(); // Optional
ble.setMode(BLUEFRUIT_MODE_DATA);
Serial.println("Waiting for connections...");
Blynk.begin(auth, ble);
}
void loop() {
Blynk.run();
}

View File

@@ -0,0 +1,64 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
Note: This requires CurieBLE library
from http://librarymanager/all#CurieBLE
Warning: Bluetooth support is in beta!
*************************************************************/
//#define BLYNK_USE_DIRECT_CONNECT
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <BlynkSimpleCurieBLE.h>
#include <CurieBLE.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
BLEPeripheral blePeripheral;
void setup()
{
// Debug console
Serial.begin(9600);
delay(1000);
blePeripheral.setLocalName("Blynk");
blePeripheral.setDeviceName("Blynk");
blePeripheral.setAppearance(384);
Blynk.begin(blePeripheral, auth);
blePeripheral.begin();
Serial.println("Waiting for connections...");
}
void loop()
{
blePeripheral.poll();
Blynk.run();
}

View File

@@ -0,0 +1,72 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use BBC Micro:Bit
to connect your project to Blynk.
Note: This requires nRF5 support package:
https://github.com/sandeepmistry/arduino-nRF5
And BLEPeripheral library
from http://librarymanager/all#BLEPeripheral
or https://github.com/sandeepmistry/arduino-BLEPeripheral
1. Select: Tools -> SoftDevice -> S110
2. Select: Tools -> Programmer -> CMSIS-DAP
3. Select: Tools -> nRF5 Flash SoftDevice
4. Read and Accept License
5. Verify and Upload Sketch
NOTE: BLE support is in beta!
*************************************************************/
#define BLYNK_USE_DIRECT_CONNECT
#define BLYNK_PRINT Serial
#include <BlynkSimpleBLEPeripheral.h>
#include <BLEPeripheral.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
// Create ble serial instance, parameters are ignored for MicroBit
BLESerial SerialBLE(0, 0, 0);
void setup() {
Serial.begin(9600);
SerialBLE.setLocalName("Blynk");
SerialBLE.setDeviceName("Blynk");
SerialBLE.setAppearance(0x0080);
SerialBLE.begin();
Serial.println("Waiting for connections...");
Blynk.begin(SerialBLE, auth);
}
void loop() {
SerialBLE.poll();
if (SerialBLE) { // If BLE is connected...
Blynk.run();
}
}

View File

@@ -0,0 +1,65 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use DFRobot Bluno or BLE Link module
to connect your project to Blynk.
Please be sure to update your DFRobot firmware to at least V1.97:
https://github.com/DFRobot/BLE_firmware_V1.9
For Bluno, read instructions here:
https://www.dfrobot.com/wiki/index.php/Bluno_SKU:DFR0267
For BLE-Link, read instructions here:
https://www.dfrobot.com/wiki/index.php/BLE-Link_(SKU:TEL0073)
NOTE: BLE support is in beta!
*************************************************************/
//#define BLYNK_USE_DIRECT_CONNECT
// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX
#define BLYNK_PRINT DebugSerial
#include <BlynkSimpleSerialBLE.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
void setup()
{
// Debug console
DebugSerial.begin(9600);
DebugSerial.println("Waiting for connections...");
// Blynk will work through Serial
// Do not read or write this serial manually in your sketch
Serial.begin(115200);
Blynk.begin(Serial, auth);
}
void loop()
{
Blynk.run();
}

View File

@@ -0,0 +1,55 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use ESP32 BLE
to connect your project to Blynk.
Warning: Bluetooth support is in beta!
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#define BLYNK_USE_DIRECT_CONNECT
#include <BlynkSimpleEsp32_BLE.h>
#include <BLEDevice.h>
#include <BLEServer.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
void setup()
{
// Debug console
Serial.begin(9600);
Serial.println("Waiting for connections...");
Blynk.setDeviceName("Blynk");
Blynk.begin(auth);
}
void loop()
{
Blynk.run();
}

View File

@@ -0,0 +1,53 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use ESP32 BT
to connect your project to Blynk.
Warning: Bluetooth support is in beta!
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#define BLYNK_USE_DIRECT_CONNECT
#include <BlynkSimpleEsp32_BT.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
void setup()
{
// Debug console
Serial.begin(9600);
Serial.println("Waiting for connections...");
Blynk.setDeviceName("Blynk");
Blynk.begin(auth);
}
void loop()
{
Blynk.run();
}

View File

@@ -0,0 +1,53 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use Energia BLE
to connect your project to Blynk.
NOTE: BLE support is in beta!
*************************************************************/
//#define BLYNK_DEBUG
#define BLYNK_PRINT Serial
#define BLYNK_RUN_YIELD() { ble.handleEvents(); }
#include <BLE.h>
#include <BlynkSimpleSerialBLE.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
void setup() {
Serial.begin(115200);
ble.setLogLevel(BLE_LOG_ERRORS);
ble.begin();
ble.serial();
ble.setAdvertName("Blynk BLE");
ble.startAdvert();
Serial.println("Waiting for connections...");
Blynk.begin(ble, auth);
}
void loop() {
Blynk.run();
}

View File

@@ -0,0 +1,73 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use LightBlue Bean / Bean+
to connect your project to Blynk.
Note: For this example you need to install Bean Loader:
https://punchthrough.com/bean/guides/getting-started/intro/
NOTE: BLE support is in beta!
*************************************************************/
//#define BLYNK_USE_DIRECT_CONNECT
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX
#define BLYNK_PRINT DebugSerial
#include <BlynkSimpleSerialBLE.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
BlynkTimer timer;
void setup()
{
DebugSerial.begin(9600);
DebugSerial.println("Waiting for connections...");
// Blynk will work through Serial
// Do not read or write this serial manually in your sketch
Serial.begin();
Blynk.begin(Serial, auth);
timer.setInterval(1000L, []() {
Blynk.virtualWrite(V1, millis());
});
}
void loop()
{
Blynk.run();
timer.run();
}
// Attach a ZeRGBa widget to the Virtual pin 1
// to control the built-in RGB led!
BLYNK_WRITE(V0) {
int r = param[0].asInt();
int g = param[1].asInt();
int b = param[2].asInt();
Bean.setLed(r, g, b);
}

View File

@@ -0,0 +1,53 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use Microduino/mCookie Bluetooth LE
to connect your project to Blynk.
NOTE: BLE support is in beta!
*************************************************************/
//#define BLYNK_USE_DIRECT_CONNECT
// For CoreUSB, use Serial for debug output
#define BLYNK_PRINT Serial
#include <BlynkSimpleSerialBLE.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
void setup()
{
// Debug console
Serial.begin(9600);
Serial.println("Waiting for connections...");
// Blynk will work through Serial1
// Do not read or write this serial manually in your sketch
Serial1.begin(9600);
Blynk.begin(auth, Serial1);
}
void loop()
{
Blynk.run();
}

View File

@@ -0,0 +1,66 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use RFduino BLE
to connect your project to Blynk.
Note: This requires RFduino support package:
https://github.com/RFduino/RFduino
And BLEPeripheral library
from http://librarymanager/all#BLEPeripheral
or https://github.com/sandeepmistry/arduino-BLEPeripheral
NOTE: BLE support is in beta!
*************************************************************/
#define BLYNK_USE_DIRECT_CONNECT
#define BLYNK_PRINT Serial
#include <BlynkSimpleBLEPeripheral.h>
#include <BLEPeripheral.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
// Create ble serial instance, parameters are ignored for MicroBit
BLESerial SerialBLE(0, 0, 0);
void setup() {
Serial.begin(9600);
SerialBLE.setLocalName("Blynk");
SerialBLE.setDeviceName("Blynk");
SerialBLE.setAppearance(0x0080);
SerialBLE.begin();
Serial.println("Waiting for connections...");
Blynk.begin(SerialBLE, auth);
}
void loop() {
SerialBLE.poll();
if (SerialBLE) { // If BLE is connected...
Blynk.run();
}
}

View File

@@ -0,0 +1,52 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use Arduino + RedBearLab BLE Mini
to connect your project to Blynk.
NOTE: BLE support is in beta!
*************************************************************/
#define BLYNK_USE_DIRECT_CONNECT
#define BLYNK_PRINT Serial
#include <BlynkSimpleSerialBLE.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
#define SerialBLE Serial1 // Set Serial object
void setup()
{
// This is for debug prints
Serial.begin(9600);
Serial.println("Waiting for connections...");
SerialBLE.begin(57600); // BLE Mini uses baud 57600
Blynk.begin(SerialBLE, auth);
}
void loop()
{
Blynk.run();
}

View File

@@ -0,0 +1,65 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use RedBearLab BLE Nano
to connect your project to Blynk.
NOTE: BLE support is in beta!
*************************************************************/
//#define BLYNK_USE_DIRECT_CONNECT
#define BLYNK_PRINT Serial
#include <BlynkSimpleRedBearLab_BLE_Nano.h>
#include <BLE_API.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
uint8_t device_name[] = "Blynk";
void setup() {
Serial.begin(9600);
delay(100);
ble.init();
ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED);
ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME,
device_name, sizeof(device_name) - 1);
ble.gap().setDeviceName(device_name);
ble.gap().setTxPower(4);
Serial.println("Waiting for connections...");
// Add Blynk service...
Blynk.begin(auth);
ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
ble.gap().setAdvertisingInterval(Gap::MSEC_TO_GAP_DURATION_UNITS(1000));
ble.gap().setAdvertisingTimeout(0);
ble.startAdvertising();
}
void loop() {
Blynk.run();
}

View File

@@ -0,0 +1,69 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use RedBearLab Blend Micro
to connect your project to Blynk.
Note: This requires BLEPeripheral library
from http://librarymanager/all#BLEPeripheral
or https://github.com/sandeepmistry/arduino-BLEPeripheral
NOTE: BLE support is in beta!
*************************************************************/
#define BLYNK_USE_DIRECT_CONNECT
#define BLYNK_PRINT Serial
#include <BlynkSimpleBLEPeripheral.h>
#include <BLEPeripheral.h>
#include <SPI.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
// define pins (varies per shield/board)
#define BLE_REQ 6
#define BLE_RDY 7
#define BLE_RST 4
// create ble serial instance, see pinouts above
BLESerial SerialBLE(BLE_REQ, BLE_RDY, BLE_RST);
void setup() {
Serial.begin(9600);
SerialBLE.setLocalName("Blynk");
SerialBLE.setDeviceName("Blynk");
SerialBLE.setAppearance(0x0080);
SerialBLE.begin();
Serial.println("Waiting for connections...");
Blynk.begin(SerialBLE, auth);
}
void loop() {
SerialBLE.poll();
if (SerialBLE) { // If BLE is connected...
Blynk.run();
}
}

View File

@@ -0,0 +1,66 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use RedBear Duo BLE
to connect your project to Blynk.
NOTE: BLE support is in beta!
*************************************************************/
#if defined(ARDUINO)
SYSTEM_MODE(MANUAL); // If Arduino - do not connect to Particle cloud
#else
SYSTEM_MODE(AUTOMATIC); // Otherwise, connect to Particle cloud
#endif
//#define BLYNK_USE_DIRECT_CONNECT
#define BLYNK_PRINT Serial
#include <BlynkSimpleRedBear_Duo_BLE.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
void setup() {
Serial.begin(9600);
delay(5000);
Serial.println("Waiting for connections...");
Blynk.begin(auth);
}
void loop() {
Blynk.run();
}
// Next functions are optional.
// Add ZeRGBa Widget on V0 to control onboard LED.
BLYNK_CONNECTED() {
RGB.control(true);
}
BLYNK_WRITE(V0) {
int r = param[0].asInt();
int g = param[1].asInt();
int b = param[2].asInt();
RGB.color(r, g, b);
}

View File

@@ -0,0 +1,62 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use Arduino with HC-06/HC-05
Bluetooth 2.0 Serial Port Profile (SPP) module
to connect your project to Blynk.
Note: This only works on Android! iOS does not support SPP :(
You may need to pair the module with your smartphone
via Bluetooth settings. Default pairing password is 1234
Feel free to apply it to any other example. It's simple!
NOTE: Bluetooth support is in beta!
*************************************************************/
#define BLYNK_USE_DIRECT_CONNECT
// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX
#define BLYNK_PRINT DebugSerial
#include <BlynkSimpleSerialBLE.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
void setup()
{
// Debug console
DebugSerial.begin(9600);
DebugSerial.println("Waiting for connections...");
// Blynk will work through Serial
// 9600 is for HC-06. For HC-05 default speed is 38400
// Do not read or write this serial manually in your sketch
Serial.begin(9600);
Blynk.begin(Serial, auth);
}
void loop()
{
Blynk.run();
}

View File

@@ -0,0 +1,55 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use Serial BLE modules (HM-10, HC-08)
to connect your project to Blynk.
NOTE: BLE support is in beta!
*************************************************************/
#define BLYNK_USE_DIRECT_CONNECT
// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX
#define BLYNK_PRINT DebugSerial
#include <BlynkSimpleSerialBLE.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
void setup()
{
// Debug console
DebugSerial.begin(9600);
DebugSerial.println("Waiting for connections...");
// Blynk will work through Serial
// Do not read or write this serial manually in your sketch
Serial.begin(9600);
Blynk.begin(Serial, auth);
}
void loop()
{
Blynk.run();
}

View File

@@ -0,0 +1,55 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use Simblee BLE
to connect your project to Blynk.
NOTE: BLE support is in beta!
*************************************************************/
//#define BLYNK_USE_DIRECT_CONNECT
#define BLYNK_PRINT Serial
#include <BlynkSimpleSimbleeBLE.h>
#include <SimbleeBLE.h>
char auth[] = "YourAuthToken";
void setup()
{
Serial.begin(9600);
SimbleeBLE.deviceName = "Simblee";
SimbleeBLE.advertisementInterval = MILLISECONDS(300);
SimbleeBLE.txPowerLevel = -20; // (-20dbM to +4 dBm)
// start the BLE stack
SimbleeBLE.begin();
Serial.println("Waiting for connections...");
Blynk.begin(auth);
}
void loop()
{
Blynk.run();
}

View File

@@ -0,0 +1,86 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use AirBoard + BLE-Link
to connect your project to Blynk.
NOTE: BLE support is in beta!
*************************************************************
USB HOWTO: http://tiny.cc/BlynkUSB
*************************************************************/
//#define BLYNK_USE_DIRECT_CONNECT
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(10, 11); // RX, TX
#define BLYNK_PRINT DebugSerial
#include <BlynkSimpleSerialBLE.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
BlynkTimer timer;
void setup()
{
DebugSerial.begin(9600);
DebugSerial.println("Waiting for connections...");
// Blynk works through Serial
// Do not read or write this serial manually in your sketch
Serial.begin(115200);
Blynk.begin(Serial, auth);
setLED(0x04, 0x16, 0x10);
timer.setInterval(1000L, []() {
Blynk.virtualWrite(V1, millis());
});
}
void loop()
{
Blynk.run();
timer.run();
}
#define LED_RED 9
#define LED_GREEN 5
#define LED_BLUE 6
void setLED(byte r, byte g, byte b) {
analogWrite(LED_RED, r);
analogWrite(LED_GREEN, g);
analogWrite(LED_BLUE, b);
}
BLYNK_CONNECTED() {
setLED(0x00, 0x00, 0x20);
}
BLYNK_WRITE(V0) {
int r = param[0].asInt();
int g = param[1].asInt();
int b = param[2].asInt();
setLED(r, g, b);
}

View File

@@ -0,0 +1,71 @@
/*************************************************************
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
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
For this example you need BLEPeripheral library
from http://librarymanager/all#BLEPeripheral
or https://github.com/sandeepmistry/arduino-BLEPeripheral
Warning: Bluetooth support is in beta!
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#define BLYNK_USE_DIRECT_CONNECT
#include <BlynkSimpleBLEPeripheral.h>
#include <BLEPeripheral.h>
#include <SPI.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
// define pins (varies per shield/board)
#define BLE_REQ 10
#define BLE_RDY 2
#define BLE_RST 9
// create ble serial instance, see pinouts above
BLESerial SerialBLE(BLE_REQ, BLE_RDY, BLE_RST);
void setup()
{
// Debug console
Serial.begin(9600);
SerialBLE.setLocalName("Blynk");
SerialBLE.setDeviceName("Blynk");
SerialBLE.setAppearance(0x0080);
SerialBLE.begin();
Serial.println("Waiting for connections...");
Blynk.begin(SerialBLE, auth);
}
void loop()
{
SerialBLE.poll();
if (SerialBLE) { // If BLE is connected...
Blynk.run();
}
}