I have this code:
#include <NeoSWSerial.h>
// Serial Relay - pass UART information between
// the computer and a software serial connection
NeoSWSerial GPRS(7, 8); // RX, TX
unsigned char buffer[64];
int count = 0;
void setup()
{
GPRS.begin(9600);
Serial.begin(9600);
}
void loop()
{
while (GPRS.available()) {
buffer[count++]=GPRS.read();
if(count==64) break;
}
Serial.write(buffer,count);
clearBufferArray();
count = 0;
if (Serial.available()) {
byte b = Serial.read();
if (b == '*')
GPRS.write(0x1a);
else
GPRS.write(b);
}
}
void clearBufferArray() {
for (int i = 0; i < count; i++) {
buffer = NULL;
- }*
}
Hardware connections using Arduino UNO:
GSM TX - Digital 7
GSM RX - Digital 8
GND - GND
Arduino is connected through USB port to a laptop.
GSM is powered by a power bank, ASUS 10050mAh.
Tutorial link from where I got the code: Arduino + GSM module (SMS message, HTTP requests) - YouTube
Now I'm using open-smart A6 GSM (probably an A6 GSM clone), and this is supposed to read from the Serial Monitor and write into the GSM module. Using A6 GSM, it's advised to quickly touch the PWR pin and RST pin in order to work. I understand that this resets the module. But whenever I reset it, the output in the Serial Monitor comes out garbled and gibberish. Same even after I reset. I can issue AT commands but the monitor can only respond with gibberish. I've also tried sending an SMS using the commands to no avail.
I don't know if this is a hardware or software problem. I can confirm that this is not an Arduino problem because I've tested ADXL345 accelerometer and NEO-6M GPS and they work fine.
Someone help me with this please? Much thanks.
serialPassThrough.ino (947 Bytes)