Library to drive an A9G Module connected to a Serial Port. Based on the GPRS Wiki (chinese) (link to old wiki) mentioned in the official english documentation. And from there, based on the AT Usage Examples (chinese), English Instruction Set (pdf) and mostly from the Chinese Instruction Set (pdf) as have more details and AT commands. (We don't know -yet- the enough Chinese to understand this, so we used the Camera function within Google Translate App - we promise this is not an ad, we just used it haha)
If you are using PlatformIO, you can copy the URL of this repo, and paste it in the lib_deps
section of your platformio.ini
...
lib_deps =
...
https://github.com/AsharaStudios/ATforA9G.git
Doing as above, PlatformIO will download for you, the library in a folder inside .piolibdeps folder. You can also download one of the released versions and extract it into your lib folder of your PlatformIO project. For the first method, you can also specify a version by just adding #v0.0.0
(or whatever version you want) at the end of the URL.
Simply #include "a9gdriver.h"
at the beginning of the .cpp / .ino files you want to use the library. In the a9gdriver.h are more documentation about every function.
#include "a9gdriver.h"
#include <Arduino.h>
#include <SoftwareSerial.h> // Unless your device have more than one Serial (Serial1, Serial2, ...)
// Update according your current connection
#define A9Gtx 3
#define A9Grx 4
SoftwareSerial A9Gserial(A9Gtx,A9Grx);
A9Gdriver A9G(A9Gserial); // Pass the Serial connected to the A9G, to the A9G Driver
void setup(){
...
A9Gserial.begin(9600);
}
Currently there is no echo handling of AT commands, so the echoes are being disabled because the library disable it by sending ATE0
. This means that after using this library, you want to test your A9(G) back on terminal, you will see that as you type the AT commands you will not see what you have typed: you will only see the AT corresponding replies (yes, press "Intro", it will work even if you no saw what you typed), unless you enable the echoes back by sending ATE1
.