Fix build

This commit is contained in:
Volodymyr Shymanskyy
2016-12-08 14:21:26 +02:00
parent 96e5febf1f
commit c31c1544ce
2 changed files with 19 additions and 6 deletions

View File

@@ -6,7 +6,8 @@
#include <TinyGsmClient.h> #include <TinyGsmClient.h>
TinyGsmClient client(Serial); TinyGsm modem(Serial);
TinyGsmClient client(modem);
char server[] = "somewhere"; char server[] = "somewhere";
char resource[] = "something"; char resource[] = "something";
@@ -14,11 +15,23 @@ char resource[] = "something";
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
delay(3000); delay(3000);
client.restart(); modem.restart();
} }
void loop() { void loop() {
if (!client.networkConnect("YourAPN", "", "")) { modem.restart();
modem.begin();
modem.getOperator();
modem.getSimCCID();
modem.getSimStatus();
modem.waitForNetwork();
if (!modem.gprsConnect("YourAPN", "", "")) {
delay(10000); delay(10000);
return; return;
} }
@@ -43,7 +56,7 @@ void loop() {
client.stop(); client.stop();
client.networkDisconnect(); modem.gprsDisconnect();
// Do nothing forevermore // Do nothing forevermore
while (true) { while (true) {

View File

@@ -60,7 +60,7 @@ void setup() {
} }
void loop() { void loop() {
if (!modem.networkConnect(apn, user, pass)) { if (!modem.gprsConnect(apn, user, pass)) {
delay(10000); delay(10000);
return; return;
} }
@@ -92,7 +92,7 @@ void loop() {
client.stop(); client.stop();
modem.networkDisconnect(); modem.gprsDisconnect();
SerialMon.println(); SerialMon.println();
SerialMon.println("************************"); SerialMon.println("************************");