Show Posts
Pages: 1 2 [3] 4 5 ... 402
31  Using Arduino / Networking, Protocols, and Devices / Re: trouble using GET to retrieve public API XML data on: August 22, 2014, 07:16:22 am
The reason your client.connect() didn't work (returned connected when in fact it wasn't) is explained in this thread:
http://forum.arduino.cc/index.php?topic=262417.0
32  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet client connect can return negative number on: August 22, 2014, 06:26:43 am
If you want to evaluate why it failed, here are the return value meanings:
Code:
#define SUCCESS          1
#define TIMED_OUT        -1
#define INVALID_SERVER   -2
#define TRUNCATED        -3
#define INVALID_RESPONSE -4

edit: I changed my playground web client examples to evaluate to success if return value is 1 rather than not 0.

After a test and then evaluating the dns library code, the "INVALID RESPONSE" is a return value value from -4 to -10. I tried connecting to a non-existent domain and the client.connect() function returned -5.

@doughboy: Did you want to report the error? Here is a link to the github for Arduino. That is where we are supposed to report website, example, and reference errors.
https://github.com/arduino/Arduino/
33  Using Arduino / Networking, Protocols, and Devices / Re: communication problem (Ethernet shield and EFCom GPRS/GSM Shield) on: August 21, 2014, 06:09:53 pm
You only need to start Serial1 once, just like Serial.
Code:
void setup() {
    Serial.begin(19200);
    Serial1.begin(19200);
 
   pinMode(6, OUTPUT);
    internet.connectToInternet();
    digitalWrite(6, HIGH); // Power on GSM shield
    delay(10000); // wait for connect to gsm network
    gsm.sendSms("Any text")
}
You are not reading the response from the modem, so it will be almost impossible to troubleshoot.
Code:
    delay(1000); //Wait for a second while the modem sends an "OK"
What if it isn't sending an "OK"?
34  Using Arduino / Networking, Protocols, and Devices / Re: communication problem (Ethernet shield and EFCom GPRS/GSM Shield) on: August 21, 2014, 05:10:32 pm
Maybe you should post the code you are trying.
35  Using Arduino / Networking, Protocols, and Devices / Re: communication problem (Ethernet shield and EFCom GPRS/GSM Shield) on: August 21, 2014, 04:54:51 pm
Are you changing the code from mySerial to Serial1?
36  Using Arduino / Networking, Protocols, and Devices / Re: communication problem (Ethernet shield and EFCom GPRS/GSM Shield) on: August 21, 2014, 03:59:55 pm
You can't use D50-D53 with the ethernet shield. Those are the SPI data lines. They are duplicated on the ICSP connector.

I would use hardware serial on the Mega. Use Serial1 instead.

37  Using Arduino / Networking, Protocols, and Devices / Re: communication problem (Ethernet shield and EFCom GPRS/GSM Shield) on: August 21, 2014, 03:41:21 pm
Power could be an issue. Both devices require a bit of current.

But as far as interfacing, the Mega 2560 has some software serial limitations last I heard. If you are using software serial (D2 and D3), the Mega may have problems.

This is from the software serial reference:
Quote
Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).
38  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Ethernet Shield used to Create Simple WebPage not Working on: August 21, 2014, 11:13:09 am
You need to find the correct network settings for your localnet. You must get your computer or laptop close enough to the router to view the dhcp info. Use this code to get your network settings. This should show you all the settings you need.
Code:
#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {  0x00, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

void setup() {
  Serial.begin(9600);

  // disable SD SPI
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);

  Serial.print(F("Starting ethernet..."));
  if(!Ethernet.begin(mac)) Serial.println(F("failed"));
  else {
      Serial.print(F("IP: "));
      Serial.println(Ethernet.localIP());
      Serial.print(F("Subnet: "));
      Serial.println(Ethernet.subnetMask());
      Serial.print(F("Gateway: "));
      Serial.println(Ethernet.gatewayIP());
      Serial.print(F("DNS server: "));
      Serial.println(Ethernet.dnsServerIP());
}

void loop() {
}
39  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Ethernet Shield used to Create Simple WebPage not Working on: August 21, 2014, 07:45:18 am
Give that a try. If the dhcp startup fails, it may take a couple minutes to display the "DHCP failed" message. If it doesn't display anything for a few minutes, that can be caused by a SD card in the shield's slot. If you have a SD card in the shield's slot , remove it for this test.

If it fails, I have another test you can try.

edit: This code tests the SPI connection to the w5100. If the serial monitor shows 192.168.2.2, then it is working ok. If it shows anything else, like 0.0.0.0 or 255.255.255.255, then you have a problem there.
Code:
#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,2,2);

void setup() {
  Serial.begin(9600);

  // disable SD SPI
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);

  // Start ethernet
  Serial.print(F("Starting ethernet..."));
  Ethernet.begin(mac, ip);
  Serial.println(Ethernet.localIP());

  delay(2000);
  Serial.println(F("Ready"));
}

void loop() {
}
40  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Ethernet Shield used to Create Simple WebPage not Working on: August 21, 2014, 07:12:17 am
That ethernet shield should work ok. It has the ICSP connector. I use a WiFi shield R3 on an Mega R2. There is a requirement to use a jumper from the 5v pin to the ioref pin on the shield.

Are you certain you are using an IP in the localnet range of the ethernet ports on the router?  What make/model router do you have?

edit: You shouldn't need any jumpers or pin bending to use the pre-R3 ethernet shields with an R3 Uno or Mega as long as the shield has the ICSP socket on the bottom.

Have you tried using DHCP on the shield to get an IP?
Code:
void setup()
{
  if(!Ethernet.begin(mac)) Serial.println("DHCP failed");

  Serial.println(Ethernet.localIP());

  server.begin();
  Serial.begin(9600);
}
41  Using Arduino / Networking, Protocols, and Devices / Re: trouble using GET to retrieve public API XML data on: August 20, 2014, 09:56:15 am
It will be only a few domains that will be affected. It appears to be when the domain name uses a CNAME (alias server name) for the main domain name.
42  Using Arduino / Networking, Protocols, and Devices / Re: trouble using GET to retrieve public API XML data on: August 20, 2014, 06:28:41 am
There is a difference between a DHCP server's failure to issue a DNS server, and the DNS server issued being unable to resolve the domain name correctly.

This code works for me.
Code:
/*
  Web client modified to read wave height data
 
 This sketch connects to a website (http://www.google.com)
 using an Arduino Wiznet Ethernet shield.
 
 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 
 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe, based on work by Adrian McEwen
 
 */

#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[] = { 0x90, 0xA2, 0xDA, 0x0F, 0x9C, 0xEB };
// 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(140,90,78,215);
//char server[] = "co-ops-nos.1.noaa.gov";

// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192,168,0,177);

// 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() {
  pinMode(4, OUTPUT);
  digitalWrite(4, HIGH);
 
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip);
  }
  // give the Ethernet shield a second to initialize:
  delay(2000);
  Serial.println("connecting...");

  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.println("connected");
    // Make a HTTP request:
    client.println("GET /api/datagetter?date=latest&station=8516945&product=one_minute_water_level&datum=STND&units=metric&time_zone=gmt&application=web_services&format=xml HTTP/1.0");
    client.println("Host: tidesandcurrents.noaa.gov");
    client.println("Connection: close");
    client.println();
  }
  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);
  }
}

edit: Here is the serial monitor output.
Quote
connecting...
connected
HTTP/1.1 200 OK
Date: Wed, 20 Aug 2014 11:22:36 GMT
Server: GlassFish Server Open Source Edition 3.1.2.2
X-Powered-By: JSP/2.2
Cache-Control: no-cache,no-store,must-revalidate
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/xml;charset=ISO-8859-1
Vary: User-Agent,Accept-Encoding
Connection: close
Set-Cookie: SERVERID=A; path=/

<?xml version="1.0" encoding="UTF-8" ?>
<data>
<metadata id="8516945"  name="Kings Point" lat="40.8103" lon="-73.7649"/>
<observations>
<ts t="2014-08-20 11:12"  v="6.020" />
</observations>
</data>

disconnecting.
43  Using Arduino / Networking, Protocols, and Devices / Re: trouble using GET to retrieve public API XML data on: August 19, 2014, 12:52:55 pm
It's not the DHCP that is failing. It is the DNS resolution on that domain. I'll post my working version of your code latter.
44  Using Arduino / Networking, Protocols, and Devices / Re: Using a Raspberry PI as a gateway with an XBee/Arduino Sensor Network on: August 19, 2014, 08:44:57 am
It is more difficult than you think. You must install the LAMP server package on the RPi and libmysqld-dev to interface C programs with the MySQL package.
http://www.raspberrypi.org/forums/viewtopic.php?f=33&t=70281&p=509755#p509755

Then search Google for the rest, or post a question on the RPi forum.
45  Using Arduino / Networking, Protocols, and Devices / Re: trouble using GET to retrieve public API XML data on: August 19, 2014, 07:52:21 am
The Arduino ethernet library is apparently having problems with the DNS on that domain. Use an IP address instead. It works fine here using an IP.
Code:
IPAddress server(140,90,78,215);


I even tried removing the protocol from your server entry and it still has trouble with resolving the dns on that domain.
Pages: 1 2 [3] 4 5 ... 402