Skip to content

Commit e350c2c

Browse files
added github actions, moved apn and co to arduino_secrets.h
1 parent c761c5d commit e350c2c

13 files changed

+40
-64
lines changed

Diff for: README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# Arduino 4G Module Library
1+
# Arduino Cellular
2+
3+
[![Check Arduino](https://github.com/arduino-libraries/Arduino_UnifiedStorage/actions/workflows/check-arduino.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_UnifiedStorage/actions/workflows/check-arduino.yml) [![Compile Examples](https://github.com/arduino-libraries/Arduino_UnifiedStorage/actions/workflows/compile-examples.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_UnifiedStorage/actions/workflows/compile-examples.yml) [![Spell Check](https://github.com/arduino-libraries/Arduino_UnifiedStorage/actions/workflows/spell-check.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_UnifiedStorage/actions/workflows/spell-check.yml) [![Sync Labels](https://github.com/arduino-libraries/Arduino_UnifiedStorage/actions/workflows/sync-labels.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_UnifiedStorage/actions/workflows/sync-labels.yml)
4+
25

36
This library provides a toolkit for interacting with the official Arduino 4G Modules. It allows you to connect to the internet, send and receive SMS messages, and get location from the cellular network or GPS.
47

Diff for: examples/HTTPClient/HTTPClient.ino

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
11
#define ARDUINO_CELLULAR_DEBUG
22

33
#include "ArduinoCellular.h"
4+
#include "arduino_secrets.h"
45

56

6-
const char apn[] = "live.vodafone.com";
7-
const char gprsUser[] = "live";
8-
const char gprsPass[] = "";
9-
107
const char server[] = "vsh.pp.ua";
118
const char resource[] = "/TinyGSM/logo.txt";
129
const int port = 80;
1310

1411
ArduinoCellular cellular = ArduinoCellular();
15-
//TinyGsmClient networkClient = cellular.getNetworkClient();
16-
//HttpClient http = HttpClient(networkClient, server, port);
17-
HttpClient http = cellular.getHTTPClient(server, port);
12+
HttpClient http = cellular.getHTTPClient(server, port);
1813

1914

2015
void setup(){
2116
Serial.begin(115200);
2217
while (!Serial);
2318
cellular.begin();
24-
cellular.connect(apn, gprsUser, gprsPass);
19+
cellular.connect(SECRET_GPRS_APN, SECRET_GPRS_LOGIN, SECRET_GPRS_PASSWORD, SECRET_PINNUMBER);
2520
}
2621

2722
void loop(){

Diff for: examples/HTTPClient/arduino_secrets.h

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#define SECRET_PINNUMBER "" // replace with your SIM card PIN
2+
#define SECRET_GPRS_APN "apn" // replace with your GPRS APN
3+
#define SECRET_GPRS_LOGIN "login" // replace with your GPRS login
4+
#define SECRET_GPRS_PASSWORD "password" // replace with your GPRS password

Diff for: examples/HTTPSClient/HTTPSClient.ino

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
#include <ArduinoHttpClient.h>
55
#include "arduino_secrets.h"
66

7-
const char apn[] = "live.vodafone.com";
8-
const char gprsUser[] = "live";
9-
const char gprsPass[] = "";
107

118
const char server[] = "example.com";
129
const char resource[] = "/";
@@ -20,7 +17,7 @@ void setup(){
2017
while (!Serial);
2118

2219
cellular.begin();
23-
cellular.connect(apn, gprsUser, gprsPass);
20+
cellular.connect(SECRET_GPRS_APN, SECRET_GPRS_LOGIN, SECRET_GPRS_PASSWORD, SECRET_PINNUMBER);
2421
}
2522

2623
void loop()

Diff for: examples/HTTPSClient/arduino_secrets.h

+4-33
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,4 @@
1-
//CA Certificate for www.howsmyssl.com (valid until 04-07-2021)
2-
const char root_ca[] PROGMEM =
3-
"-----BEGIN CERTIFICATE-----\n"
4-
"MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwD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rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI\n"
20-
"rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV\n"
21-
"HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq\n"
22-
"hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL\n"
23-
"ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ\n"
24-
"3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK\n"
25-
"NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5\n"
26-
"ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur\n"
27-
"TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC\n"
28-
"jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc\n"
29-
"oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq\n"
30-
"4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA\n"
31-
"mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d\n"
32-
"emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=\n"
33-
"-----END CERTIFICATE-----\n";
1+
#define SECRET_PINNUMBER "" // replace with your SIM card PIN
2+
#define SECRET_GPRS_APN "apn" // replace with your GPRS APN
3+
#define SECRET_GPRS_LOGIN "login" // replace with your GPRS login
4+
#define SECRET_GPRS_PASSWORD "password" // replace with your GPRS password

Diff for: examples/ModemTerminal/ModemTerminal.ino

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
#include "ArduinoCellular.h"
2+
#include "arduino_secrets.h"
23

34

45
ArduinoCellular cellular = ArduinoCellular();
56

67
float lat = 0.00;
78
float lon = 0.00;
89

9-
const char apn[] = "live.vodafone.com";
10-
const char gprsUser[] = "live";
11-
const char gprsPass[] = "";
1210

1311
void setup(){
1412
Serial.begin(115200);
1513
while (!Serial);
1614
cellular.begin();
17-
cellular.connect(apn, gprsUser, gprsPass);
15+
cellular.connect(SECRET_GPRS_APN, SECRET_GPRS_LOGIN, SECRET_GPRS_PASSWORD, SECRET_PINNUMBER);
1816
}
1917

2018
void loop() {

Diff for: examples/ModemTerminal/arduino_secrets.h

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#define SECRET_PINNUMBER "" // replace with your SIM card PIN
2+
#define SECRET_GPRS_APN "apn" // replace with your GPRS APN
3+
#define SECRET_GPRS_LOGIN "login" // replace with your GPRS login
4+
#define SECRET_GPRS_PASSWORD "password" // replace with your GPRS password

Diff for: examples/SMSReceive/SMSReceive.ino

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#include "ArduinoCellular.h"
2+
#include "arduino_secrets.h"
3+
24

3-
const char apn[] = "live.vodafone.com";
4-
const char gprsUser[] = "live";
5-
const char gprsPass[] = "";
65

76
#define TINY_GSM_DEBUG Serial
87
#define ARDUINO_CELLULAR_DEBUG
@@ -29,7 +28,7 @@ void setup(){
2928
Serial.begin(115200);
3029
while (!Serial);
3130
cellular.begin();
32-
cellular.connect(apn, gprsUser, gprsPass);
31+
cellular.connect(SECRET_GPRS_APN, SECRET_GPRS_LOGIN, SECRET_GPRS_PASSWORD, SECRET_PINNUMBER);
3332

3433

3534
attachInterrupt(digitalPinToInterrupt(A0), newSMSCallback, RISING);

Diff for: examples/SMSReceive/arduino_secrets.h

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#define SECRET_PINNUMBER "" // replace with your SIM card PIN
2+
#define SECRET_GPRS_APN "apn" // replace with your GPRS APN
3+
#define SECRET_GPRS_LOGIN "login" // replace with your GPRS login
4+
#define SECRET_GPRS_PASSWORD "password" // replace with your GPRS password

Diff for: examples/TimeAndLocation/TimeAndLocation.ino

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#define DUMP_AT_COMMANDS
22

33
#include "ArduinoCellular.h"
4-
4+
#include "arduino_secrets.h"
55

66
ArduinoCellular cellular = ArduinoCellular();
77

@@ -15,16 +15,12 @@ int minute = 0;
1515
int second = 0;
1616

1717

18-
const char apn[] = "internet";
19-
const char gprsUser[] = "";
20-
const char gprsPass[] = "";
21-
2218
void setup(){
2319
Serial.begin(115200);
2420
while (!Serial);
2521
cellular.begin();
26-
//cellularModem.connect(apn, gprsUser, gprsPass);
27-
cellular.enableGPS(false);
22+
//cellular.connect(SECRET_GPRS_APN, SECRET_GPRS_LOGIN, SECRET_GPRS_PASSWORD, SECRET_PINNUMBER);
23+
//cellular.enableGPS(false);
2824
}
2925

3026
void loop(){

Diff for: examples/TimeAndLocation/arduino_secrets.h

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#define SECRET_PINNUMBER "" // replace with your SIM card PIN
2+
#define SECRET_GPRS_APN "apn" // replace with your GPRS APN
3+
#define SECRET_GPRS_LOGIN "login" // replace with your GPRS login
4+
#define SECRET_GPRS_PASSWORD "password" // replace with your GPRS password

Diff for: src/ArduinoCellular.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@ class ArduinoCellular {
9595
* @param apn The Access Point Name.
9696
* @param gprsUser The GPRS username.
9797
* @param gprsPass The GPRS password.
98+
* @param pin The SIM card PIN.
9899
* @return True if the connection is successful, false otherwise.
99100
*/
100-
bool connect(const char * apn, const char * gprsUser, const char * gprsPass);
101+
bool connect(const char * apn, const char * gprsUser, const char * gprsPass, const char * pin);
101102

102103
/**
103104
* @brief Checks if the modem is registered on the network.

Diff for: src/ArdunioCellular.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ void ArduinoCellular::begin() {
4141

4242
}
4343

44-
bool ArduinoCellular::connect(const char * apn, const char * gprsUser, const char * gprsPass){
44+
bool ArduinoCellular::connect(const char * apn, const char * gprsUser, const char * gprsPass, const char * pin){
4545
SimStatus simStatus = getSimStatus();
4646
if(simStatus == SimStatus::SIM_LOCKED) {
47-
unlockSIM("1234");
47+
unlockSIM(pin);
4848
}
4949

5050
simStatus = getSimStatus();

0 commit comments

Comments
 (0)