I need help with my arduino mega and SIM868. I connect SIM868 to arduino mega serial1.
Want to use GPS stream widget but when I start Blynk app the hardware is not online.
/*************************************************************
/*************************************************************
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:
http://tiny.cc/tiny-gsm-readme
WARNING: GSM modem support is for BETA testing.
Output any data on Map widget!
App project setup:
Map widget on V1
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#define TINY_GSM_MODEM_SIM800
// 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 <BlynkSimpleSIM800.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "JfwLDUsmA7BuxufVD9L8E9GMk4347efes";
// Your GPRS credentials
// Leave empty, if missing user or pass
char apn[] = "gprswap";
char user[] = "mts";
char pass[] = "064";
// 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);
WidgetMap myMap(V1);
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);
// If you want to remove all points:
//myMap.clear();
int index = 0;
float lat = 51.5074;
float lon = 0.1278;
myMap.location(index, lat, lon, "value");
}
void loop()
{
Blynk.run();
}
This is serial output…
19:35:16.743 -> Initializing modem...
19:35:23.601 -> [9791]
19:35:23.601 -> ___ __ __
19:35:23.601 -> / _ )/ /_ _____ / /__
19:35:23.601 -> / _ / / // / _ \/ '_/
19:35:23.648 -> /____/_/\_, /_//_/_/\_\
19:35:23.695 -> /___/ v0.6.1 on Arduino Mega
19:35:23.742 ->
19:35:23.742 -> [9884] Modem init...
19:35:24.445 -> [10655] Connecting to network...
19:35:40.707 -> [26734] Network: 22005
19:35:40.707 -> [26735] Connecting to vipmobile ...
19:35:52.982 -> [38899] Connected to GPRS
19:35:52.982 -> [38908] Connecting to blynk-cloud.com:80
19:36:07.034 -> [52819] Connecting to blynk-cloud.com:80
19:36:21.077 -> [66720] Connecting to blynk-cloud.com:80
19:36:35.086 -> [80610] Connecting to blynk-cloud.com:80
19:36:49.090 -> [94503] Connecting to blynk-cloud.com:80
19:37:03.135 -> [108408] Connecting to blynk-cloud.com:80
19:37:17.169 -> [122320] Connecting to blynk-cloud.com:80
19:37:31.189 -> [136209] Connecting to blynk-cloud.com:80
19:37:45.214 -> [150105] Connecting to blynk-cloud.com:80
19:37:59.258 -> [164013] Connecting to blynk-cloud.com:80
19:38:13.289 -> [177914] Connecting to blynk-cloud.com:80