GSM shield sim900 relay control via web

There is a GSM Shield and I include conceived through the relay module is not SMS or call and through the web site, sketched a rough sketch but it does not respond to it, please tell me what’s wrong?Again, to manage via a Web (no sms and phone calls). sorry for my English :slight_smile: :slight_smile: :slight_smile:

arduino code:

#include “SIM900.h”
#include “SoftwareSerial.h”
#include “inetGSM.h”

int Relay = 5; // Relay module In1
int Relay2 = 4; // Relay module In2

InetGSM inet;
int cmd; // Command from server
boolean state1; // State of relay1; true = relay1 is OFF
boolean state2; // State of relay2; true = relay2 is OFF

//============================================================
void setup()
{
int n_of_at = 0;

pinMode(Relay, OUTPUT);
pinMode(Relay2, OUTPUT);
pinMode(Relay, LOW);
pinMode(Relay2, LOW);
state1 = false;
state2 = false;
digitalWrite(Relay, state1);
digitalWrite(Relay2, state2);

//Serial connection.
Serial.begin(9600);
Serial.println(“GSM Shield RelayCtrl”);

// Start configuration of shield with baudrate.
// For http uses is raccomanded to use 4800 or slower.
if (gsm.begin(2400))
{
Serial.println(“Software Serial begin at 9600”);
//gsm.forceON();
}
// GPRS attach, put in order APN, username and password.
// If no needed auth let them blank.
//gsm.SimpleWriteln(“AT+CIPMODE=1”);
delay(2000);
if (inet.attachGPRS(“internet.mts.ru”, “mts”, “mts”))
{
Serial.println(“APN Settings ok! Starting GPRS Connection!”);
//Read IP address.
gsm.SimpleWriteln(“AT+CIFSR”);
delay(5000);
gsm.WhileSimpleRead();

while (n_of_at < 3) {
if (!inet.connectTCP(“188.120.236.202”, 80)) {
#ifdef DEBUG_ON
Serial.println(“DB:NOT CONN”);
#endif
n_of_at++;
} else {
n_of_at = 3;
}
}
delay(5000);
Serial.println("\nTCP Server waiting at port: 80");
Serial.println("\n");
}
else
{
Serial.println(“Error while strarting up server…”);
Serial.println(“Please check APN settings”);
}
delay(5000);
}

//============================================================
void loop()
{
cmd = gsm.read();

// If the command is 'o’ne => toggle relay1
if (cmd == ‘o’)
{
state1 = !state1;
digitalWrite(Relay, state1);
Serial.println(“Relay1 toggle”);
}
else
{
// If the command is 't’wo => toggle relay2
if (cmd == ‘t’)
{
state2 = !state2;
digitalWrite(Relay2, state2);
Serial.println(“Relay2 toggle”);
}
}
}

serial.php:

<?php $service_port = '8009'; $address = '10.110.87.158'; $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $result = socket_connect($socket, $address, $service_port); if ($_GET['O']){ socket_write($socket, 'o'); } else if ($_GET['T']){ socket_write($socket, 't'); } socket_close($socket); ?>

index.html:

<?php $service_port = '8009'; $address = '10.110.87.158'; $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $result = socket_connect($socket, $address, $service_port); if ($_GET['O']){ socket_write($socket, 'o'); } else if ($_GET['T']){ socket_write($socket, 't'); } socket_close($socket); ?>