Skip to content

Commit 689a76a

Browse files
committed
Initial commit of Arduino library.
0 parents  commit 689a76a

File tree

16 files changed

+2259
-0
lines changed

16 files changed

+2259
-0
lines changed

.gitattributes

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
# Custom for Visual Studio
5+
*.cs diff=csharp
6+
7+
# Standard to msysgit
8+
*.doc diff=astextplain
9+
*.DOC diff=astextplain
10+
*.docx diff=astextplain
11+
*.DOCX diff=astextplain
12+
*.dot diff=astextplain
13+
*.DOT diff=astextplain
14+
*.pdf diff=astextplain
15+
*.PDF diff=astextplain
16+
*.rtf diff=astextplain
17+
*.RTF diff=astextplain

.gitignore

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# IDE settings directories/folders
2+
.vscode/
3+
4+
# Windows image file caches
5+
Thumbs.db
6+
ehthumbs.db
7+
8+
# Folder config file
9+
Desktop.ini
10+
11+
# Recycle Bin used on file shares
12+
$RECYCLE.BIN/
13+
14+
# Windows Installer files
15+
*.cab
16+
*.msi
17+
*.msm
18+
*.msp
19+
20+
# Windows shortcuts
21+
*.lnk
22+
23+
# C build files
24+
_build
25+
*.elf
26+
*.hex
27+
*.exe
28+
29+
# Arduino CLI config file
30+
*.yml
31+
Makefile
32+
33+
# =========================
34+
# Operating System Files
35+
# =========================
36+
37+
# OSX
38+
# =========================
39+
40+
.DS_Store
41+
.AppleDouble
42+
.LSOverride
43+
44+
# Thumbnails
45+
._*
46+
47+
# Files that might appear in the root of a volume
48+
.DocumentRevisions-V100
49+
.fseventsd
50+
.Spotlight-V100
51+
.TemporaryItems
52+
.Trashes
53+
.VolumeIcon.icns
54+
55+
# Directories potentially created on remote AFP share
56+
.AppleDB
57+
.AppleDesktop
58+
Network Trash Folder
59+
Temporary Items
60+
.apdisk

ISSUE_TEMPLATE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
### Subject of the issue
2+
Describe your issue here.
3+
4+
### Your workbench
5+
* What platform are you using?
6+
* What version of the device are you using? Is there a firmware version?
7+
* How is the device wired to your platform?
8+
* How is everything being powered?
9+
* Are there any additional details that may help us help you?
10+
11+
### Steps to reproduce
12+
Tell us how to reproduce this issue. Please post stripped down example code demonstrating your issue to a gist.
13+
14+
### Expected behaviour
15+
Tell us what should happen
16+
17+
### Actual behaviour
18+
Tell us what happens instead

LICENSE.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
SparkFun License Information
2+
============================
3+
4+
SparkFun uses two different licenses for our files — one for hardware and one for code.
5+
6+
Hardware
7+
---------
8+
9+
**SparkFun hardware is released under [Creative Commons Share-alike 4.0 International](http://creativecommons.org/licenses/by-sa/4.0/).**
10+
11+
Note: This is a human-readable summary of (and not a substitute for) the [license](http://creativecommons.org/licenses/by-sa/4.0/legalcode).
12+
13+
You are free to:
14+
15+
Share — copy and redistribute the material in any medium or format
16+
Adapt — remix, transform, and build upon the material
17+
for any purpose, even commercially.
18+
The licensor cannot revoke these freedoms as long as you follow the license terms.
19+
Under the following terms:
20+
21+
Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
22+
ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
23+
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
24+
Notices:
25+
26+
You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation.
27+
No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.
28+
29+
30+
Code
31+
--------
32+
33+
**SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).**
34+
35+
The MIT License (MIT)
36+
37+
Copyright (c) 2016 SparkFun Electronics
38+
39+
Permission is hereby granted, free of charge, to any person obtaining a copy
40+
of this software and associated documentation files (the "Software"), to deal
41+
in the Software without restriction, including without limitation the rights
42+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43+
copies of the Software, and to permit persons to whom the Software is
44+
furnished to do so, subject to the following conditions:
45+
46+
The above copyright notice and this permission notice shall be included in all
47+
copies or substantial portions of the Software.
48+
49+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
55+
SOFTWARE.

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
SparkFun LTE Shield Arduino Library
2+
==============================
3+
4+
[DESCRIPTION]
5+
6+
Repository Contents
7+
-------------------
8+
9+
* **/examples** - Example sketches for the library (.ino). Run these from the Arduino IDE.
10+
* **/src** - Source files for the library (.cpp, .h).
11+
* **keywords.txt** - Keywords from this library that will be highlighted in the Arduino IDE.
12+
* **library.properties** - General library properties for the Arduino package manager.
13+
14+
Documentation
15+
-------------
16+
17+
Coming soon!
18+
19+
License Information
20+
-------------------
21+
22+
This product is _**open source**_!
23+
24+
Various bits of the code have different licenses applied. Anything SparkFun wrote is beerware; if you see me (or any other SparkFun employee) at the local, and you've found our code helpful, please buy us a round!
25+
26+
Please use, reuse, and modify these files as you see fit. Please maintain attribution to SparkFun Electronics and release anything derivative under the same license.
27+
28+
Distributed as-is; no warranty is given.
29+
30+
- Your friends at SparkFun.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#include <SparkFun_LTE_Shield_Arduino_Library.h>
2+
3+
SoftwareSerial lteSerial(8, 9);
4+
LTE_Shield lte;
5+
6+
// Map registration status messages to more readable strings
7+
String registrationString[] = {
8+
"Not registered", // 0
9+
"Registered, home", // 1
10+
"Searching for operator", // 2
11+
"Registration denied", // 3
12+
"Registration unknown", // 4
13+
"Registrered, roaming", // 5
14+
"Registered, home (SMS only)", // 6
15+
"Registered, roaming (SMS only)", // 7
16+
"Registered, home, CSFB not preferred", // 8
17+
"Registered, roaming, CSFB not prefered" // 9
18+
};
19+
20+
void setup() {
21+
Serial.begin(9600);
22+
23+
Serial.println(F("Initializing the LTE Shield..."));
24+
Serial.println(F("...this may take ~25 seconds if the shield is off."));
25+
Serial.println(F("...it may take ~5 seconds if it just turned on."));
26+
27+
if ( lte.begin(lteSerial, 9600) ) {
28+
Serial.println(F("LTE Shield connected!"));
29+
}
30+
Serial.println();
31+
32+
Serial.println("Getting device/SIM info:");
33+
// Print device information:
34+
// IMEI: International Mobile Equipment Identity -- Unique number to identify phone
35+
Serial.println("IMEI: " + lte.imei());
36+
// IMSI: International Mobile Subscriber Identity -- Unique number to identify
37+
// user of a cellular network.
38+
Serial.println("IMSI: " + lte.imsi());
39+
// ICCID: Integrated circuit card identifier -- Unique SIM card serial number.
40+
Serial.println("ICCID: " + lte.ccid());
41+
Serial.println();
42+
43+
// Network operator can be set to either:
44+
// MNO_ATT -- AT&T
45+
// MNO_VERIZON -- Verizon
46+
// MNO_TELSTRA -- Telstra
47+
// MNO_TMO -- T-Mobile
48+
if (!lte.setNetwork(MNO_VERIZON)) {
49+
Serial.println(F("Error setting network. Try cycling power on your Arduino/shield."));
50+
while (1) ;
51+
}
52+
53+
Serial.println("Network set. Ready to go!");
54+
// RSSI: Received signal strength:
55+
Serial.println("RSSI: " + String(lte.rssi()));
56+
// Registration Status
57+
int regStatus = lte.registration();
58+
if ((regStatus >= 0) && (regStatus <= 9)) {
59+
Serial.println("Network registration: " + registrationString[regStatus]);
60+
}
61+
if (regStatus > 0) {
62+
Serial.println("All set. Go to the next example!");
63+
}
64+
}
65+
66+
void loop() {
67+
}

examples/01_SMS_Send/01_SMS_Send.ino

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include <SparkFun_LTE_Shield_Arduino_Library.h>
2+
3+
SoftwareSerial lteSerial(8, 9);
4+
LTE_Shield lte;
5+
6+
String destinationNumber = "11234567890";
7+
8+
void setup() {
9+
Serial.begin(9600);
10+
11+
if ( lte.begin(lteSerial, 9600) ) {
12+
Serial.println(F("LTE Shield connected!"));
13+
}
14+
Serial.println(F("Type a message. Send a Newline (\\n) to send it..."));
15+
}
16+
17+
void loop() {
18+
static String message = "";
19+
if (Serial.available())
20+
{
21+
char c = Serial.read();
22+
if (c == '\n') {
23+
Serial.println("Sending: " + String(message));
24+
lte.sendSMS(destinationNumber, message);
25+
message = "";
26+
} else {
27+
message += c;
28+
}
29+
}
30+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#include <SparkFun_LTE_Shield_Arduino_Library.h>
2+
3+
SoftwareSerial lteSerial(8, 9);
4+
LTE_Shield lte;
5+
6+
String hologramDeviceKey = "LC2tG5cf";
7+
8+
const char HOLOGRAM_URL[] = "cloudsocket.hologram.io";
9+
const unsigned int HOLOGRAM_PORT = 9999;
10+
const unsigned int HOLOGRAM_LISTEN_PORT = 4010;
11+
12+
void setup() {
13+
Serial.begin(9600);
14+
15+
if ( lte.begin(lteSerial, 9600) ) {
16+
Serial.println(F("LTE Shield connected!"));
17+
}
18+
19+
Serial.println(F("Type a message. Send a Newline (\\n) to send it..."));
20+
}
21+
22+
void loop() {
23+
lte.poll();
24+
}
25+
26+
void sendHologramMessage(String message)
27+
{
28+
int socket = -1;
29+
String hologramMessage;
30+
31+
hologramMessage = "{\"k\":\"" + hologramDeviceKey + "\",\"d\":\"" +
32+
message + "\"}";
33+
34+
socket = lte.socketOpen(LTE_SHIELD_TCP);
35+
if (socket >= 0) {
36+
Serial.println("Connecting to socket: " + String(socket));
37+
if (lte.socketConnect(socket, HOLOGRAM_URL, HOLOGRAM_PORT) == LTE_SHIELD_ERROR_SUCCESS) {
38+
Serial.println("Connected to Hologram.io");
39+
Serial.println("Sending: " + String(hologramMessage));
40+
if (lte.socketWrite(socket, hologramMessage) == LTE_SHIELD_ERROR_SUCCESS)
41+
{
42+
lte.socketClose(socket);
43+
}
44+
}
45+
}
46+
}

0 commit comments

Comments
 (0)