I have spent two weeks learning everything i can to give me an understanding of how the Arduino works and how the coding works so that i can complete my project and be able to hopefully talk to others with an understand that would allow me to solve my issue.
But i am struggling and really need help.
I have tried lots of codes from on here and from youtube videos but i don't get a return result , sometimes i just get jumble or nothing .I'm not going to included all the codes which i used as I'm sure someone will spot the problem pretty quick.
HARDWARE
laptop
arduino uno R3 with mega328p
SOS Arduino Compatible M95 GSM / GPRS Shield https://www.rapidonline.com/pdf/75-0548_v1.pdf as its to large to attach.
CODEING AIM
if i can just get to the stage of writing and sending AT commands from the computer through the arduino and to the gsm shield. and then get the response to appear back on the computer i can write my code from there and show other how i did it
i have been using other peoples codes attached is two of which i have tried. the data sheet provided with the GSM shield can be found at https://www.rapidonline.com/pdf/75-0548_v1.pdf as its to large to attach.
#include <SoftwareSerial.h>
SoftwareSerial GPRS(0, 1);
unsigned char buffer[64]; // buffer array for data recieve over serial port
int count=0; // counter for buffer array
void setup()
{
GPRS.begin(9600); // the GPRS baud rate
Serial.begin(9600); // the Serial port of Arduino baud rate.
}
void loop()
{
while(GPRS.available()) // reading data into char array
{
buffer[count++]=GPRS.read(); // writing data into array
if(count == 64) break;
}
Serial.write(buffer,count); // if no data transmission ends, write buffer to hardware serial port
clearBufferArray(); // call clearBufferArray function to clear the storaged data from the array
count = 0; // set counter of while loop to zero
if (Serial.available()) {
byte b = Serial.read();
if ( b == '*')
GPRS.write( 0x1a ); // replace * with ctrl+z
else
GPRS.write(b);
}
}
void clearBufferArray()
{
for (int i=0; i<count;i++)
{
buffer[i]=NULL;
}
}
/*
Serial Event example
When new serial data arrives, this sketch adds it to a String.
When a newline is received, the loop prints the string and
clears it.
A good test for this is to try it with a GPS receiver
that sends out NMEA 0183 sentences.
Created 9 May 2011
by Tom Igoe
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/SerialEvent
*/
String inputString = ""; // a string to hold incoming data
boolean stringComplete = false; // whether the string is complete
void setup() {
// initialize serial:
Serial.begin(9600);
// reserve 200 bytes for the inputString:
inputString.reserve(200);
}
void loop() {
// print the string when a newline arrives:
if (stringComplete) {
Serial.println(inputString);
// clear the string:
inputString = "";
stringComplete = false;
}
}
please can some one help me construct a code .
i think my mistake is that i am not understanding the pins on the gsm data sheet and might need to include more pins in my code.