Thanks for replying.
my code for the gsm module
#include <SoftwareSerial.h>
SoftwareSerial mySerial(7, 8);
//String a;call
char a;
int b=0;
void setup() {
mySerial.begin(19200); // opens serial port, sets data rate to 9600 bps
Serial.begin(19200); // Setting the baud rate of Serial Monitor (Arduino)
Serial.println("GSM SIM900A BEGIN");
}
void loop() {
if (mySerial.available()) {
a= mySerial.read();
Serial.print(a);
if (a=='R'){
b++;
Serial.print("RING COUNT = ");
// Serial.print(" || ");
// Serial.println(a);
Serial.print(b);
}
if(b==4)
{
mySerial.println("ATH");
Serial.println("RING HANG");// Hang up at command
delay(100);
b=0;
}
if(a=='+'){
Serial.println(" Caller_id: ");
}
}
}
the problem with the gsm module is i only get the ring on the serial monitor when i call my number on it.
i cant find a way to save the output into a variable
the out put is this
RRING COUNT =
1
ING
+Caller_id: CLIP: "+Caller_id: 971557292422",145,"",,"",0
RRING COUNT =
2
ING
+Caller_id: CLIP: "+Caller_id: 971557292422",145,"",,"",0
RRING COUNT =
3
ING
+Caller_id: CLIP: "+Caller_id: 971557292422",145,"",,"",0
RRING COUNT =
4
RING HANG
ING
ATH
OK
if theres any way to save this into a variable then i can replace it with the tem and hum data and send it to the website.
code to post to website
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// Enter the IP address for Arduino, as mentioned we will use 192.168.0.16
// Be careful to use , insetead of . when you enter the address here
IPAddress ip(192,168,1,154);
int photocellPin = 0; // Analog input pin on Arduino we connected the SIG pin from sensor
int photocellReading; // Here we will place our reading
// Initialize the Ethernet server library
EthernetServer server(80);
void setup() {
// Serial.begin starts the serial connection between computer and Arduino
Serial.begin(9600);
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
Serial.print("Arduino server IP address: ");
Serial.println(Ethernet.localIP());
}
void loop() {
photocellReading = analogRead(photocellPin); // Fill the sensorReading with the information from sensor
EthernetClient client = server.available(); // Listen for incoming clients
if (client) {
// When a client sends a request to a webserver, that request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
// This line is used to send communication information between Arduino and your browser over Serial Monitor
Serial.write(c);
// When the request has ended send the client a reply
if (c == '\n' && currentLineIsBlank) {
// We send the HTTP response code to the client so it knows that we will send him HTML data
// and to refresh the webpage every 5 seconds
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println("Refresh: 5");
client.println();
// Here we write HTML data (for the page itself) which will be sent to the client.
// The HTML includes Javascript which fills the data
client.println("");
client.println("");
client.println("");
client.println("Arduino sensor data");
client.println("");
client.println("");
client.println("");
client.println("
");
client.println("
Light measured from the sensor is:
");
client.println("
");
client.println("");
client.println("");
break;
}
if (c == '\n') {
// Check if a new line is started
currentLineIsBlank = true;
}
else if (c != '\r') {
// If a new line was not strated
currentLineIsBlank = false;
}
}
}
// Give the client some time to recieve the data (1ms)
delay(100);
// In the end close the connection
client.stop();
}
}