初始化提交
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
/*************************************************************
|
||||
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
|
||||
Follow us: 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 MKRGSM 1400
|
||||
to connect your project to Blynk.
|
||||
|
||||
Note: This requires MKRGSM library
|
||||
from https://www.arduino.cc/en/Reference/MKRGSM
|
||||
|
||||
Feel free to apply it to any other example. It's simple!
|
||||
*************************************************************/
|
||||
|
||||
/* Comment this out to disable prints and save space */
|
||||
#define BLYNK_PRINT Serial
|
||||
|
||||
#include <SPI.h>
|
||||
#include <MKRGSM.h>
|
||||
#include <BlynkSimpleMKRGSM.h>
|
||||
|
||||
GSMClient client;
|
||||
GPRS gprs;
|
||||
GSM gsmAccess;
|
||||
|
||||
|
||||
// You should get Auth Token in the Blynk App.
|
||||
// Go to the Project Settings (nut icon).
|
||||
char auth[] = "YourAuthToken";
|
||||
|
||||
// Your SIM and GPRS credentials
|
||||
// Leave empty, if missing pin, user or pass
|
||||
char pin[] = "";
|
||||
char apn[] = "YourAPN";
|
||||
char user[] = "";
|
||||
char pass[] = "";
|
||||
|
||||
void setup()
|
||||
{
|
||||
// Debug console
|
||||
Serial.begin(9600);
|
||||
|
||||
Blynk.begin(auth, gsmAccess, gprs, client, pin, apn, user, pass);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blynk.run();
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*************************************************************
|
||||
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
|
||||
Follow us: 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 MKRNB 1500
|
||||
to connect your project to Blynk.
|
||||
Note: This requires MKRGSM library
|
||||
from https://www.arduino.cc/en/Reference/MKRNB
|
||||
Feel free to apply it to any other example. It's simple!
|
||||
*************************************************************/
|
||||
/* Comment this out to disable prints and save space */
|
||||
#define BLYNK_PRINT Serial
|
||||
|
||||
#include <MKRNB.h>
|
||||
#include <BlynkSimpleMKRNB.h>
|
||||
|
||||
NBClient client;
|
||||
GPRS gprs;
|
||||
NB nbAccess;
|
||||
// You should get Auth Token in the Blynk App.
|
||||
// Go to the Project Settings (nut icon).
|
||||
char auth[] = "YourAuthToken";
|
||||
// Your SIM credential
|
||||
// Leave empty, if missing pin
|
||||
char pin[] = "";
|
||||
|
||||
void setup()
|
||||
{
|
||||
// Debug console
|
||||
Serial.begin(9600);
|
||||
Blynk.begin(auth, nbAccess, gprs, client , pin);
|
||||
}
|
||||
void loop()
|
||||
{
|
||||
Blynk.run();
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*************************************************************
|
||||
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
|
||||
Follow us: http://www.fb.com/blynkapp
|
||||
http://twitter.com/blynk_app
|
||||
|
||||
Blynk library is licensed under MIT license
|
||||
This example code is in public domain.
|
||||
|
||||
*************************************************************
|
||||
Attention! Please check out TinyGSM guide:
|
||||
https://tiny.cc/tinygsm-readme
|
||||
|
||||
Change GPRS apm, user, pass, and Blynk auth token to run :)
|
||||
Feel free to apply it to any other example. It's simple!
|
||||
|
||||
*************************************************************/
|
||||
|
||||
/* Comment this out to disable prints and save space */
|
||||
#define BLYNK_PRINT Serial
|
||||
|
||||
// Arduino MKR GSM 1400 uses U-blox modem
|
||||
#define TINY_GSM_MODEM_UBLOX
|
||||
|
||||
// Default heartbeat interval for GSM is 60
|
||||
// If you want override this value, uncomment and set this option:
|
||||
//#define BLYNK_HEARTBEAT 30
|
||||
|
||||
#include <TinyGsmClient.h>
|
||||
#include <BlynkSimpleTinyGSM.h>
|
||||
|
||||
// You should get Auth Token in the Blynk App.
|
||||
// Go to the Project Settings (nut icon).
|
||||
char auth[] = "YourAuthToken";
|
||||
|
||||
// Your GPRS credentials
|
||||
// Leave empty, if missing user or pass
|
||||
char apn[] = "YourAPN";
|
||||
char user[] = "";
|
||||
char pass[] = "";
|
||||
|
||||
TinyGsm modem(SerialGSM);
|
||||
|
||||
void setup()
|
||||
{
|
||||
// Debug console
|
||||
Serial.begin(9600);
|
||||
|
||||
delay(10);
|
||||
|
||||
// Set GSM module baud rate
|
||||
SerialGSM.begin(115200);
|
||||
|
||||
pinMode(GSM_DTR, OUTPUT);
|
||||
digitalWrite(GSM_DTR, LOW);
|
||||
delay(5);
|
||||
|
||||
// Turn on the GSM module by triggering GSM_RESETN pin
|
||||
pinMode(GSM_RESETN, OUTPUT);
|
||||
digitalWrite(GSM_RESETN, HIGH);
|
||||
delay(100);
|
||||
digitalWrite(GSM_RESETN, LOW);
|
||||
|
||||
delay(1000);
|
||||
|
||||
// Restart takes quite some time
|
||||
// To skip it, call init() instead of restart()
|
||||
Serial.println("Initializing modem...");
|
||||
modem.restart();
|
||||
|
||||
// Unlock your SIM card with a PIN
|
||||
//modem.simUnlock("1234");
|
||||
|
||||
Blynk.begin(auth, modem, apn, user, pass);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blynk.run();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/*************************************************************
|
||||
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
|
||||
Follow us: http://www.fb.com/blynkapp
|
||||
http://twitter.com/blynk_app
|
||||
|
||||
Blynk library is licensed under MIT license
|
||||
This example code is in public domain.
|
||||
|
||||
*************************************************************
|
||||
Attention! Please check out TinyGSM guide:
|
||||
https://tiny.cc/tinygsm-readme
|
||||
|
||||
Change GPRS apm, user, pass, and Blynk auth token to run :)
|
||||
Feel free to apply it to any other example. It's simple!
|
||||
|
||||
*************************************************************/
|
||||
|
||||
/* Comment this out to disable prints and save space */
|
||||
#define BLYNK_PRINT Serial
|
||||
|
||||
// Select your modem:
|
||||
#define TINY_GSM_MODEM_SIM800
|
||||
//#define TINY_GSM_MODEM_SIM900
|
||||
//#define TINY_GSM_MODEM_M590
|
||||
//#define TINY_GSM_MODEM_A6
|
||||
//#define TINY_GSM_MODEM_A7
|
||||
//#define TINY_GSM_MODEM_BG96
|
||||
//#define TINY_GSM_MODEM_XBEE
|
||||
|
||||
// Default heartbeat interval for GSM is 60
|
||||
// If you want override this value, uncomment and set this option:
|
||||
//#define BLYNK_HEARTBEAT 30
|
||||
|
||||
#include <TinyGsmClient.h>
|
||||
#include <BlynkSimpleTinyGSM.h>
|
||||
|
||||
// You should get Auth Token in the Blynk App.
|
||||
// Go to the Project Settings (nut icon).
|
||||
char auth[] = "YourAuthToken";
|
||||
|
||||
// Your GPRS credentials
|
||||
// Leave empty, if missing user or pass
|
||||
char apn[] = "YourAPN";
|
||||
char user[] = "";
|
||||
char pass[] = "";
|
||||
|
||||
// Hardware Serial on Mega, Leonardo, Micro
|
||||
#define SerialAT Serial1
|
||||
|
||||
// or Software Serial on Uno, Nano
|
||||
//#include <SoftwareSerial.h>
|
||||
//SoftwareSerial SerialAT(2, 3); // RX, TX
|
||||
|
||||
TinyGsm modem(SerialAT);
|
||||
|
||||
void setup()
|
||||
{
|
||||
// Debug console
|
||||
Serial.begin(9600);
|
||||
|
||||
delay(10);
|
||||
|
||||
// Set GSM module baud rate
|
||||
SerialAT.begin(115200);
|
||||
delay(3000);
|
||||
|
||||
// Restart takes quite some time
|
||||
// To skip it, call init() instead of restart()
|
||||
Serial.println("Initializing modem...");
|
||||
modem.restart();
|
||||
|
||||
// Unlock your SIM card with a PIN
|
||||
//modem.simUnlock("1234");
|
||||
|
||||
Blynk.begin(auth, modem, apn, user, pass);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blynk.run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user