Update Blynk and MQTT examples

This commit is contained in:
Volodymyr Shymanskyy
2018-03-14 21:42:08 +02:00
parent 6aa1ebbd77
commit d9fdc98291
2 changed files with 53 additions and 42 deletions

View File

@@ -41,15 +41,8 @@
#include <TinyGsmClient.h>
#include <BlynkSimpleSIM800.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
const char auth[] = "YourAuthToken";
// Your GPRS credentials
// Leave empty, if missing user or pass
const char apn[] = "YourAPN";
const char user[] = "";
const char pass[] = "";
// Set serial for debug console (to the Serial Monitor, default speed 115200)
#define SerialMon Serial
// Hardware Serial on Mega, Leonardo, Micro
#define SerialAT Serial1
@@ -58,12 +51,23 @@ const char pass[] = "";
//#include <SoftwareSerial.h>
//SoftwareSerial SerialAT(2, 3); // RX, TX
// Your GPRS credentials
// Leave empty, if missing user or pass
const char apn[] = "YourAPN";
const char user[] = "";
const char pass[] = "";
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
const char auth[] = "YourAuthToken";
TinyGsm modem(SerialAT);
void setup()
{
// Set console baud rate
Serial.begin(115200);
SerialMon.begin(115200);
delay(10);
// Set GSM module baud rate
@@ -72,12 +76,12 @@ void setup()
// Restart takes quite some time
// To skip it, call init() instead of restart()
Serial.println("Initializing modem...");
SerialMon.println("Initializing modem...");
modem.restart();
String modemInfo = modem.getModemInfo();
Serial.print("Modem: ");
Serial.println(modemInfo);
SerialMon.print("Modem: ");
SerialMon.println(modemInfo);
// Unlock your SIM card with a PIN
//modem.simUnlock("1234");