User Tools

Site Tools


arduino:sim900

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
arduino:sim900 [2017/04/23 17:30] – created aistisarduino:sim900 [2017/05/08 16:25] (current) – aistis
Line 1: Line 1:
 GPS and GPRS board GPS and GPRS board
 +
 +http://wiki.seeed.cc/GPRS_Shield_v1.0/
 +
 +https://raw.githubusercontent.com/SeeedDocument/GPRS_Shield_v1.0/master/img/GPRS_Shield_interface.png
  
 <code> <code>
Line 9: Line 13:
  
 #include <SoftwareSerial.h> #include <SoftwareSerial.h>
- 
 SoftwareSerial GPRS(7, 8); SoftwareSerial GPRS(7, 8);
-unsigned char buffer[64]; // buffer array for data recieve over serial port 
-int count=0;     // counter for buffer array 
 void setup() void setup()
 { {
     GPRS.begin(19200);               // the GPRS baud rate     GPRS.begin(19200);               // the GPRS baud rate
     Serial.begin(19200);             // the Serial port of Arduino baud rate.     Serial.begin(19200);             // the Serial port of Arduino baud rate.
- 
 } }
  
 void loop() void loop()
 { {
-    if (GPRS.available())              // if date is comming from softwareserial port ==> data is comming from gprs shield +    if (GPRS.available()) 
-    { +    Serial.write(GPRS.read()); 
-        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())            // if data is available on hardwareserial port ==> data is comming from PC or notebook     if (Serial.available())            // if data is available on hardwareserial port ==> data is comming from PC or notebook
     GPRS.write(Serial.read());       // write it to the GPRS shield     GPRS.write(Serial.read());       // write it to the GPRS shield
 } }
-void clearBufferArray()              // function to clear buffer array +
-{ +
-    for (int i=0; i<count;i++) +
-    { buffer[i]=NULL;}                  // clear all index of array with command NULL +
-}+
 </code> </code>
arduino/sim900.1492957840.txt.gz · Last modified: by aistis