(Use arduino mega and Ethernet shield )
this is my code {
#include <SPI.h>
#include <Ethernet.h>
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xB8, 0x88, 0xE3, 0x46, 0xDA, 0xCA };
// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
//IPAddress server(74,125,232,128); // numeric IP for Google (no DNS)
char server[] = "www.google.com"; // name address for Google (using DNS)
// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 1, 90);
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
// start the Ethernet connection:
Ethernet.begin(mac, ip, subnet, gateway);
// give the Ethernet shield a second to initialize:
delay(1000);
Serial.println("connecting...");
// if you get a connection, report back via serial:
if (client.connect(server, 80)) {
Serial.println("connected");
// Make your API request:
client.print("GET /http://api.clickatell.com/http/sendmsg?");
client.print("user=mohammed.athamneh");
client.print("&password=*******");
client.print("&api_id=3539833");
client.print("&to=********");
client.print("&text=hello");
client.print("HTTP/1.1");
client.println("Host: www.clickatell.com");
client.println("Connection: close");
client.println();
Serial.print("Sending HHTP ");
}
else {
// kf you didn't get a connection to the server:
Serial.println("connection failed");
}
}
void loop()
{
// if there are incoming bytes available
// from the server, read them and print them:
if (client.available()) {
char c = client.read();
Serial.print(c);
}
// if the server's disconnected, stop the client:
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
// do nothing forevermore:
while(true);
}
}
}
when enter this url in browser received sms to my phone ??!?!?!?
but in arduino do nothing ??? why and what is wrong in my code ?
this is the url : http://api.clickatell.com/http/sendmsg?user=mohammed.athamneh&password=&api_id=3539833&to=**&text=hello