first commit
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
/*************************************************************
|
||||
Blynk is a platform with iOS and Android apps to control
|
||||
ESP32, Arduino, Raspberry Pi and the likes over the Internet.
|
||||
You can easily build mobile and web interfaces for any
|
||||
projects by simply dragging and dropping widgets.
|
||||
|
||||
Downloads, docs, tutorials: https://www.blynk.io
|
||||
Sketch generator: https://examples.blynk.cc
|
||||
Blynk community: https://community.blynk.cc
|
||||
Follow us: https://www.fb.com/blynkapp
|
||||
https://twitter.com/blynk_app
|
||||
|
||||
Blynk library is licensed under MIT license
|
||||
This example code is in public domain.
|
||||
|
||||
*************************************************************
|
||||
|
||||
You’ll need:
|
||||
- Blynk App (download from AppStore or Google Play)
|
||||
- Arduino UNO or similar microcontroller board
|
||||
- Decide how to connect to Blynk
|
||||
(USB, Ethernet, Wi-Fi, Bluetooth, ...)
|
||||
|
||||
There is a bunch of great example sketches included to show you how to get
|
||||
started. Think of them as LEGO bricks and combine them as you wish.
|
||||
For example, take the Ethernet Shield sketch and combine it with the
|
||||
Servo example, or choose a USB sketch and add a code from SendData
|
||||
example.
|
||||
*************************************************************
|
||||
|
||||
Let’s turn ON your LED with Blynk!
|
||||
In this example we'll use Arduino UNO + Ethernet Shield
|
||||
|
||||
5 Steps guide:
|
||||
|
||||
1. Connect LED to Pin 9
|
||||
( http://arduino.cc/en/uploads/Tutorial/simplefade_bb.png )
|
||||
|
||||
In the Blynk App:
|
||||
2. Create New Project
|
||||
3. Email yourself Auth Token. You can do it later at any time
|
||||
4. Add a Button Widget. Select Pin D9 in Widget's Settings
|
||||
5. Press Play icon. Enjoy Blynking!
|
||||
|
||||
You can find a QR code for easy setup of this project here:
|
||||
https://github.com/blynkkk/blynk-library/tree/master/examples/GettingStarted/BlynkBlink
|
||||
|
||||
*************************************************************/
|
||||
|
||||
#define BLYNK_PRINT Serial // Enables Serial Monitor
|
||||
|
||||
/* Fill in information from Blynk Device Info here */
|
||||
//#define BLYNK_TEMPLATE_ID "TMPxxxxxx"
|
||||
//#define BLYNK_TEMPLATE_NAME "Device"
|
||||
//#define BLYNK_AUTH_TOKEN "YourAuthToken"
|
||||
|
||||
|
||||
// Following includes are for Arduino Ethernet Shield (W5100)
|
||||
// If you're using another shield, see Boards_* examples
|
||||
#include <SPI.h>
|
||||
#include <Ethernet.h>
|
||||
#include <BlynkSimpleEthernet.h>
|
||||
|
||||
void setup()
|
||||
{
|
||||
// See the connection status in Serial Monitor
|
||||
Serial.begin(9600);
|
||||
|
||||
// Here your Arduino connects to the Blynk Cloud.
|
||||
Blynk.begin(BLYNK_AUTH_TOKEN);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// All the Blynk Magic happens here...
|
||||
Blynk.run();
|
||||
|
||||
// You can inject your own code or combine it with other sketches.
|
||||
// Check other examples on how to communicate with Blynk. Remember
|
||||
// to avoid delay() function!
|
||||
}
|
||||
|
||||
62
libraries/Blynk/examples/GettingStarted/GetData/GetData.ino
Normal file
62
libraries/Blynk/examples/GettingStarted/GetData/GetData.ino
Normal file
@@ -0,0 +1,62 @@
|
||||
/*************************************************************
|
||||
Blynk is a platform with iOS and Android apps to control
|
||||
ESP32, Arduino, Raspberry Pi and the likes over the Internet.
|
||||
You can easily build mobile and web interfaces for any
|
||||
projects by simply dragging and dropping widgets.
|
||||
|
||||
Downloads, docs, tutorials: https://www.blynk.io
|
||||
Sketch generator: https://examples.blynk.cc
|
||||
Blynk community: https://community.blynk.cc
|
||||
Follow us: https://www.fb.com/blynkapp
|
||||
https://twitter.com/blynk_app
|
||||
|
||||
Blynk library is licensed under MIT license
|
||||
This example code is in public domain.
|
||||
|
||||
*************************************************************
|
||||
|
||||
You can use this sketch as a debug tool that prints all incoming values
|
||||
sent by a widget connected to a Virtual Pin 1 in the Blynk App.
|
||||
|
||||
App dashboard setup:
|
||||
Slider widget (0...100) on V1
|
||||
*************************************************************/
|
||||
|
||||
/* Comment this out to disable prints and save space */
|
||||
#define BLYNK_PRINT Serial
|
||||
|
||||
/* Fill in information from Blynk Device Info here */
|
||||
//#define BLYNK_TEMPLATE_ID "TMPxxxxxx"
|
||||
//#define BLYNK_TEMPLATE_NAME "Device"
|
||||
//#define BLYNK_AUTH_TOKEN "YourAuthToken"
|
||||
|
||||
|
||||
#include <SPI.h>
|
||||
#include <Ethernet.h>
|
||||
#include <BlynkSimpleEthernet.h>
|
||||
|
||||
// This function will be called every time Slider Widget
|
||||
// in Blynk app writes values to the Virtual Pin 1
|
||||
BLYNK_WRITE(V1)
|
||||
{
|
||||
int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
|
||||
// You can also use:
|
||||
// String i = param.asStr();
|
||||
// double d = param.asDouble();
|
||||
Serial.print("V1 Slider value is: ");
|
||||
Serial.println(pinValue);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
// Debug console
|
||||
Serial.begin(9600);
|
||||
|
||||
Blynk.begin(BLYNK_AUTH_TOKEN);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blynk.run();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*************************************************************
|
||||
Blynk is a platform with iOS and Android apps to control
|
||||
ESP32, Arduino, Raspberry Pi and the likes over the Internet.
|
||||
You can easily build mobile and web interfaces for any
|
||||
projects by simply dragging and dropping widgets.
|
||||
|
||||
Downloads, docs, tutorials: https://www.blynk.io
|
||||
Sketch generator: https://examples.blynk.cc
|
||||
Blynk community: https://community.blynk.cc
|
||||
Follow us: https://www.fb.com/blynkapp
|
||||
https://twitter.com/blynk_app
|
||||
|
||||
Blynk library is licensed under MIT license
|
||||
This example code is in public domain.
|
||||
|
||||
*************************************************************
|
||||
|
||||
This example shows how value can be pushed from Arduino to
|
||||
the Blynk App.
|
||||
|
||||
NOTE:
|
||||
BlynkTimer provides SimpleTimer functionality:
|
||||
http://playground.arduino.cc/Code/SimpleTimer
|
||||
|
||||
App dashboard setup:
|
||||
Value Display widget attached to Virtual Pin V5
|
||||
*************************************************************/
|
||||
|
||||
/* Comment this out to disable prints and save space */
|
||||
#define BLYNK_PRINT Serial
|
||||
|
||||
/* Fill in information from Blynk Device Info here */
|
||||
//#define BLYNK_TEMPLATE_ID "TMPxxxxxx"
|
||||
//#define BLYNK_TEMPLATE_NAME "Device"
|
||||
//#define BLYNK_AUTH_TOKEN "YourAuthToken"
|
||||
|
||||
|
||||
#include <SPI.h>
|
||||
#include <Ethernet.h>
|
||||
#include <BlynkSimpleEthernet.h>
|
||||
|
||||
BlynkTimer timer;
|
||||
|
||||
// This function sends Arduino's up time every second to Virtual Pin (5).
|
||||
void myTimerEvent()
|
||||
{
|
||||
// You can send any value at any time.
|
||||
// Please don't send more that 10 values per second.
|
||||
Blynk.virtualWrite(V5, millis() / 1000);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
// Debug console
|
||||
Serial.begin(9600);
|
||||
|
||||
Blynk.begin(BLYNK_AUTH_TOKEN);
|
||||
|
||||
// Setup a function to be called every second
|
||||
timer.setInterval(1000L, myTimerEvent);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blynk.run();
|
||||
timer.run(); // Initiates BlynkTimer
|
||||
}
|
||||
|
||||
59
libraries/Blynk/examples/GettingStarted/Servo/Servo.ino
Normal file
59
libraries/Blynk/examples/GettingStarted/Servo/Servo.ino
Normal file
@@ -0,0 +1,59 @@
|
||||
/*************************************************************
|
||||
Blynk is a platform with iOS and Android apps to control
|
||||
ESP32, Arduino, Raspberry Pi and the likes over the Internet.
|
||||
You can easily build mobile and web interfaces for any
|
||||
projects by simply dragging and dropping widgets.
|
||||
|
||||
Downloads, docs, tutorials: https://www.blynk.io
|
||||
Sketch generator: https://examples.blynk.cc
|
||||
Blynk community: https://community.blynk.cc
|
||||
Follow us: https://www.fb.com/blynkapp
|
||||
https://twitter.com/blynk_app
|
||||
|
||||
Blynk library is licensed under MIT license
|
||||
This example code is in public domain.
|
||||
|
||||
*************************************************************
|
||||
|
||||
Rotate a servo using a slider!
|
||||
|
||||
App dashboard setup:
|
||||
Slider widget (0...180) on V3
|
||||
*************************************************************/
|
||||
|
||||
/* Comment this out to disable prints and save space */
|
||||
#define BLYNK_PRINT Serial
|
||||
|
||||
/* Fill in information from Blynk Device Info here */
|
||||
//#define BLYNK_TEMPLATE_ID "TMPxxxxxx"
|
||||
//#define BLYNK_TEMPLATE_NAME "Device"
|
||||
//#define BLYNK_AUTH_TOKEN "YourAuthToken"
|
||||
|
||||
|
||||
#include <SPI.h>
|
||||
#include <Ethernet.h>
|
||||
#include <BlynkSimpleEthernet.h>
|
||||
#include <Servo.h>
|
||||
|
||||
Servo servo;
|
||||
|
||||
BLYNK_WRITE(V3)
|
||||
{
|
||||
servo.write(param.asInt());
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
// Debug console
|
||||
Serial.begin(9600);
|
||||
|
||||
Blynk.begin(BLYNK_AUTH_TOKEN);
|
||||
|
||||
servo.attach(9);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blynk.run();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*************************************************************
|
||||
Blynk is a platform with iOS and Android apps to control
|
||||
ESP32, Arduino, Raspberry Pi and the likes over the Internet.
|
||||
You can easily build mobile and web interfaces for any
|
||||
projects by simply dragging and dropping widgets.
|
||||
|
||||
Downloads, docs, tutorials: https://www.blynk.io
|
||||
Sketch generator: https://examples.blynk.cc
|
||||
Blynk community: https://community.blynk.cc
|
||||
Follow us: https://www.fb.com/blynkapp
|
||||
https://twitter.com/blynk_app
|
||||
|
||||
Blynk library is licensed under MIT license
|
||||
This example code is in public domain.
|
||||
|
||||
*************************************************************
|
||||
|
||||
This sketch shows how to read values from Virtual Pins
|
||||
|
||||
App dashboard setup:
|
||||
Slider widget (0...100) on Virtual Pin V1
|
||||
*************************************************************/
|
||||
|
||||
/* Comment this out to disable prints and save space */
|
||||
#define BLYNK_PRINT Serial
|
||||
|
||||
/* Fill in information from Blynk Device Info here */
|
||||
//#define BLYNK_TEMPLATE_ID "TMPxxxxxx"
|
||||
//#define BLYNK_TEMPLATE_NAME "Device"
|
||||
//#define BLYNK_AUTH_TOKEN "YourAuthToken"
|
||||
|
||||
|
||||
#include <SPI.h>
|
||||
#include <Ethernet.h>
|
||||
#include <BlynkSimpleEthernet.h>
|
||||
|
||||
// This function will be called every time Slider Widget
|
||||
// in Blynk app writes values to the Virtual Pin V1
|
||||
BLYNK_WRITE(V1)
|
||||
{
|
||||
int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
|
||||
|
||||
// process received value
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
// Debug console
|
||||
Serial.begin(9600);
|
||||
|
||||
Blynk.begin(BLYNK_AUTH_TOKEN);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blynk.run();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/*************************************************************
|
||||
Blynk is a platform with iOS and Android apps to control
|
||||
ESP32, Arduino, Raspberry Pi and the likes over the Internet.
|
||||
You can easily build mobile and web interfaces for any
|
||||
projects by simply dragging and dropping widgets.
|
||||
|
||||
Downloads, docs, tutorials: https://www.blynk.io
|
||||
Sketch generator: https://examples.blynk.cc
|
||||
Blynk community: https://community.blynk.cc
|
||||
Follow us: https://www.fb.com/blynkapp
|
||||
https://twitter.com/blynk_app
|
||||
|
||||
Blynk library is licensed under MIT license
|
||||
This example code is in public domain.
|
||||
|
||||
*************************************************************
|
||||
|
||||
This sketch shows how to write values to Virtual Pins
|
||||
|
||||
NOTE:
|
||||
BlynkTimer provides SimpleTimer functionality:
|
||||
http://playground.arduino.cc/Code/SimpleTimer
|
||||
|
||||
App dashboard setup:
|
||||
Value Display widget attached to Virtual Pin V5
|
||||
*************************************************************/
|
||||
|
||||
/* Comment this out to disable prints and save space */
|
||||
#define BLYNK_PRINT Serial
|
||||
|
||||
/* Fill in information from Blynk Device Info here */
|
||||
//#define BLYNK_TEMPLATE_ID "TMPxxxxxx"
|
||||
//#define BLYNK_TEMPLATE_NAME "Device"
|
||||
//#define BLYNK_AUTH_TOKEN "YourAuthToken"
|
||||
|
||||
|
||||
#include <SPI.h>
|
||||
#include <Ethernet.h>
|
||||
#include <BlynkSimpleEthernet.h>
|
||||
|
||||
BlynkTimer timer;
|
||||
|
||||
// This function sends Arduino's up time every second to Virtual Pin (5)
|
||||
void myTimerEvent()
|
||||
{
|
||||
// You can send any value at any time.
|
||||
// Please don't send more that 10 values per second.
|
||||
Blynk.virtualWrite(V5, millis() / 1000);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
// Debug console
|
||||
Serial.begin(9600);
|
||||
|
||||
Blynk.begin(BLYNK_AUTH_TOKEN);
|
||||
|
||||
// Setup a function to be called every second
|
||||
timer.setInterval(1000L, myTimerEvent);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blynk.run();
|
||||
timer.run(); // Initiates BlynkTimer
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user