Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Test Examples for FONA 3G #81

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
036eab1
Update Readme.md
simonmags Jun 21, 2016
2e866f7
updated pull request
simonmags Jun 21, 2016
a4caf46
Update GSP.no
simonmags Jun 21, 2016
311bdb8
wake FONA to send SMS
simonmags Jun 27, 2016
39eea7d
Update wake_FONA_to_send_SMS
simonmags Jun 27, 2016
0332448
3g-http-experiment.ino
simonmags Nov 14, 2016
86e7ed1
Update to Comments
simonmags Nov 14, 2016
ec67c19
Updated Readme with 3G Product Codes
simonmags Jan 24, 2017
ef84ba3
Deleted Test 3G file
simonmags Jan 24, 2017
9b6fe85
auto_answer_call_FONA_3G.ino
simonmags Jan 24, 2017
9b0249b
Switch from Arduino to mraa
Feb 1, 2017
0e0907d
Use file to send with put request only.
Feb 8, 2017
301d0ec
Wait for +CHTTPS: RECV EVENT until download content
Feb 8, 2017
3145a20
Open file outside PUT request method, Improve Timing/Robustness in re…
Feb 10, 2017
2f715df
Add time measurement for http request and remove unused code
Feb 13, 2017
13adef1
Make DEBUG_PRINT print to stdout
Feb 13, 2017
70e125f
Restructure HTTP request methods
Feb 14, 2017
1e046cd
Add .gitignore
Feb 14, 2017
589ccd3
Add FONAtest.cpp that works with the mraa branch of the repo
Feb 14, 2017
77d11e6
Fix POST request header
Feb 14, 2017
37587cb
Add FONA3G_setbaud.cpp to change baudrates
Feb 14, 2017
4d03185
Update incoming_call
simonmags Aug 21, 2017
26960be
Updated Incoming_call
simonmags Aug 21, 2017
8129f2b
edited incomingCall.ino
simonmags Aug 21, 2017
89cc865
Edited auto answer file for Travis CI
simonmags Aug 21, 2017
2ae2d76
updated
simonmags Aug 21, 2017
0037501
edited file
simonmags Aug 21, 2017
9bbbc27
Edited
simonmags Aug 21, 2017
354aad9
Return to default constructor
simonmags Aug 21, 2017
eb8f4b8
minor edits
simonmags Aug 21, 2017
feaef4f
Deleted File
simonmags Aug 21, 2017
8a4291f
Merge remote-tracking branch 'origin/mraa'
simonmags Aug 21, 2017
c83dd7e
Updated Folder Structure
simonmags Aug 21, 2017
c88d81b
Updated Examples
simonmags Aug 21, 2017
eb8cf5b
Create library.properties
simonmags Aug 23, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ Also don't be worried if the request is closed or not integrated--sometimes the
priorities of Adafruit's GitHub code (education, ease of use) might not match the
priorities of the pull request. Don't fret, the open source community thrives on
forks and GitHub makes it easy to keep your changes in a forked repo.

After reviewing the guidelines above you can delete this text from the pull request.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Adafruit FONA Library [![Build Status](https://secure.travis-ci.org/adafruit/Adafruit_FONA_Library.svg?branch=master)](https://travis-ci.org/adafruit/Adafruit_FONA_Library)
# Adafruit FONA Library

**This library requires Arduino v1.0.6 or higher**

This is a library for the Adafruit FONA Cellular GSM Breakouts etc
This is a library for the Adafruit FONA Cellular GSM Breakouts etc, including the 3G module.

Designed specifically to work with the Adafruit FONA Breakout
* https://www.adafruit.com/products/1946
* https://www.adafruit.com/products/1963
* http://www.adafruit.com/products/2468
* http://www.adafruit.com/products/2542
* http://www.adafruit.com/products/2696
* http://www.adafruit.com/products/2691
* http://www.adafruit.com/products/2687

These modules use TTL Serial to communicate, 2 pins are required to interface

Expand All @@ -27,3 +30,6 @@ Check that the Adafruit_FONA folder contains Adafruit_FONA.cpp and Adafruit_FONA

Place the Adafruit_FONA library folder your *arduinosketchfolder*/libraries/ folder.
You may need to create the libraries subfolder if its your first library. Restart the IDE.

To Contribute, please fork our ADAfruit_FONA repository and then submit a pull request to merge it back in with the master. To learn more about forking/pull requests etc. Follow the github help:
https://guides.github.com/activities/contributing-to-open-source/
29 changes: 14 additions & 15 deletions examples/GPS/GPS.ino
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
/**
* ___ ___ _ _ _ ___ __ ___ ___ ___ ___
* | __/ _ \| \| | /_\ ( _ )/ \( _ ) / __| _ \/ __|
* | _| (_) | .` |/ _ \ / _ \ () / _ \ | (_ | _/\__ \
* |_| \___/|_|\_/_/ \_\ \___/\__/\___/ \___|_| |___/
*
/**
* ____ _____ _ _ __ ___ ___ _ ___ ___ ___ ___ ____ ___
* ( ___)( _ )( \( ) /__\ (__ ) / __) ( ) ( _ ) / _ \ ( _ ) / __)( _ \/ __)
* )__) )(_)( ) ( /(__)\ (_ \( (_-. /_\/ / _ \( (_) )/ _ \ ( (_-. )___/\__ \
* (__) (_____)(_)\_)(__)(__) (___/ \___/ (__/\ \___/ \___/ \___/ \___/(__) (___/
* This example is meant to work with the Adafruit
* FONA 808 or 3G Shield or Breakout
*
* Copyright: 2015 Adafruit
* Copyright: 2016 Adafruit
* Author: Todd Treece
* Licence: MIT
*
*/
#include "Adafruit_FONA.h"

// standard pins for the shield, adjust as necessary
#define FONA_RX 2
#define FONA_TX 3
#define FONA_RST 4
#define FONA_RX 2 // Pin 2 goes to RX on the FONA
#define FONA_TX 3 // Pin 3 goes to TX on the FONA
#define FONA_RST 4 // Pin 4 goes to RST on the FONA

// We default to using software serial. If you want to use hardware serial
// (because softserial isnt supported) comment out the following three lines
Expand All @@ -29,11 +28,11 @@ SoftwareSerial *fonaSerial = &fonaSS;
// Hardware serial is also possible!
// HardwareSerial *fonaSerial = &Serial1;

Adafruit_FONA fona = Adafruit_FONA(FONA_RST);

// Have a FONA 3G? use this object type instead
//Adafruit_FONA_3G fona = Adafruit_FONA_3G(FONA_RST);
// Have a FONA 3G? use this object type
Adafruit_FONA_3G fona = Adafruit_FONA_3G(FONA_RST);

// We default to using the newer FONA 3g module, got the older 808 module? use this object instead.
// Adafruit_FONA fona = Adafruit_FONA(FONA_RST);

void setup() {

Expand All @@ -57,7 +56,7 @@ void setup() {
}

void loop() {
delay(2000);
delay(5000);

float latitude, longitude, speed_kph, heading, speed_mph, altitude;

Expand Down
54 changes: 54 additions & 0 deletions examples/IncomingCall/auto_answer_call_FONA_3G.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#
# This code provided by Adafruit Support Rick, it is an example of how to do something upon an event, in this case
# How to do an action upon recieving a phone call (ringing).
#
# In your sketch, attach your own interrupt routine to the RING line. In the routine, set a boolean flag to true.
# Poll the boolean in your loop routine. Whenever it becomes true, do a pickup and then set the flag back to false.
#
# Let's assume you're using pin 2 for your RI line. (if you're on a Uno, you can only use pins 0, 1, 2, 3 for RI.
# But 0 and 1 are already used for the serial monitor). I've moved the other pins as necessary

#include "Adafruit_FONA.h"
#include <SoftwareSerial.h>

#define RING_PIN 2
#define FONA_TX 3
#define FONA_RX 4
#define FONA_RST 5

SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
SoftwareSerial *fonaSerial = &fonaSS;
Adafruit_FONA_3G fona = Adafruit_FONA_3G(FONA_RST);

volatile bool ringing = false;
void RingInterrupt()
{
ringing = true;
}

void setup() {
Serial.begin(115200);

fonaSerial->begin(4800);
if (! fona.begin(*fonaSerial)) {
Serial.println(F("Couldn't find FONA"));
while (1);
}

attachInterrupt(RING_PIN, RingInterrupt, FALLING);
}

void loop() {

if (ringing)
{
delay(1000); //let it ring for a second
// pick up!
if (! fona.pickUp()) {
Serial.println(F("Failed"));
} else {
Serial.println(F("OK!"));
}
ringing = false;
}
}
107 changes: 107 additions & 0 deletions examples/wake_FONA_to_send_SMS
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/***************************************************
This is an example for our Adafruit FONA Cellular Module

Designed specifically to work with the Adafruit FONA
----> http://www.adafruit.com/products/1946
----> http://www.adafruit.com/products/1963
----> http://www.adafruit.com/products/2468
----> http://www.adafruit.com/products/2542

These cellular modules use TTL Serial to communicate, 2 pins are
required to interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/

/*
THIS CODE IS STILL IN PROGRESS!

Open up the serial console on the Arduino at 115200 baud to interact with FONA

Note that if you need to set a GPRS APN, username, and password scroll down to
the commented section below at the end of the setup() function.
*/
#include "Adafruit_FONA.h"

//The atmega is wired as follows:
#define TMP 0
#define PS_LIGHT 5
#define FONA_KEY 6
#define FONA_PS 7
#define FONA_NS 8
#define FONA_TX 9
#define FONA_RX 10
#define FONA_RST 11
#define FONA_VIO 12

//TMP is the TMP36
//PS_LIGHT Is the power LED. This is used to indicate when power is on, a connection fails, or a message fails to send.

//#define FONA_RX 2
//#define FONA_TX 3
//#define FONA_RST 4

bool FonaWake() {
digitalWrite(FONA_VIO, HIGH);
if (digitalRead(FONA_PS) == LOW)
{
digitalWrite(FONA_KEY, LOW);
delay(4000);
}

digitalWrite(FONA_KEY, HIGH);

while (!Serial);
Serial.begin(115200);
Serial.println(F("Booting up FONA"));

fonaSerial->begin(4800);

if(! fona.begin(*fonaSerial)) {
failBlink(200);

return false;
}

Serial.println(F("FONA is OK"));

if (digitalRead(FONA_NS) == HIGH) {
return true;
}

// Give it a second to finish booting
delay(500);

return digitalRead(FONA_NS) == HIGH;
}

void FonaSleep() {
if (digitalRead(FONA_PS) == HIGH)
{
digitalWrite(FONA_KEY, LOW);
delay(4000);
digitalWrite(FONA_KEY, HIGH);
}

digitalWrite(FONA_VIO, LOW);

if (digitalRead(FONA_PS == LOW)) {
Serial.println("FONA OFF");
}
}

bool sendSms(char *phoneNumber, char *message) {
// send an SMS!
flushSerial();

if (!fona.sendSMS(phoneNumber, message)) {
failBlink(500);
return false;
}

return true;
}