Hi,
I m using a sim 300 gsm modem:
http://shop.sumeetinstruments.com/index.php?route=product/product&product_id=1014
And arduino uno
I m trying to send sensor data to mysql database
Here is my code (which doesn't work =( )
void setup()
{
Serial.begin(9600);
Serial.print("\r");
delay(1000);
Serial.print("AT+CGATT=1\r\n");
delay(1000);
Serial.print("AT+CIPCSGP=1,"aircelgprs"\r\n");
delay(1000);
Serial.print("AT+CSTT \r\n");
delay(1000);
Serial.print("AT+CIICR \r\n");
delay(1000);
Serial.print("AT+CIFSR \r\n");
delay(1000);
Serial.print("AT+CDNSORIP=1 \r\n");
delay(1000);
Serial.print("AT+CIPSPRT=1 \r\n");
delay(1000);
Serial.print("AT+CIPHEAD \r\n");
delay(1000);
Serial.print("AT+CIPSTART="TCP","http://base-colap.rhcloud.com","80" \r\n");
delay(1000);}
void ContactWebServer(float bend_value, float bend_state)
{
Serial.print("AT+CIPSEND \r\n");
delay(3000);
Serial.print("GET /wateralert1.php?alert=");
Serial.print(bend_value);
Serial.print("&flex=");
Serial.print(bend_state);
Serial.print(" HTTP/1.0 \r");
Serial.print("\n");
Serial.print("Host: http://.base-colap.rhcloud.com");
Serial.print("\n");
Serial.print("Connection: keep-alive");
Serial.print("\n");
Serial.print("Accept: /");
Serial.print("");
Serial.print("\n");
Serial.print("Accept-Language: en-us");
Serial.print("\n\r");
Serial.print("\n");delay(1000);
Serial.write(0x1A);
delay(1000);
}void loop()
{
float sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (100 / 1023.0000);
float cur = sensorValue * (20.0000/100.0000) * voltage;
// print out the value you read:delay(3000);
ContactWebServer(voltage,cur);
delay(5000);
}
are my AT commands correct ?