Show Posts
Pages: 1 [2] 3 4 ... 393
16  Using Arduino / Programming Questions / Re: Writing to SD card errors. on: July 29, 2014, 07:24:18 am
If you are using a Mega, you must disable the w5100 SPI by setting the slave select (D10) as OUTPUT and HIGH, or the w5100 may prevent the SD from starting correctly by trashing up the SPI bus.
  Serial.print("Initializing SD card...");
  // make sure that the w5100 chip select pin is set to OUTPUT and HIGH
  pinMode(10, OUTPUT);
  digitalWrite(10, HIGH);

  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
  Serial.println("card initialized.");

You should run SD.begin(4) only once, and that should be in the setup() function.
17  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Wifi shield can't connect to the network. on: July 28, 2014, 11:54:48 pm
The WEP keys should be listed in the router's wireless security setup. Something like this:
WEP key 1  1234567890abc
WEP key 2
WEP key 3
WEP key 4
The index would be 1,2,3,4 (or maybe 0,1,2,3)
The key for index 1 (or maybe 0) would be 1234567890abc

This applies to WEP only. WPA does not use an index.
18  Using Arduino / Programming Questions / Re: Arduino webserver images not loading on: July 28, 2014, 03:24:05 pm
I don't have that problem. Here is my code.
19  Development / Suggestions for the Arduino Project / Re: (RFID project) SD problem with Ethernet library on: July 28, 2014, 07:50:29 am
You have probably run out of SRAM. There is an easy solution. Use a Mega 2560.
20  Using Arduino / Networking, Protocols, and Devices / Re: need help on dynamic dns on: July 28, 2014, 06:55:21 am
I will post the code little later. Had anybody had the same problem. I m using arduino Uno with Ws5100 ethernet shield.
No problem here, but I don't use dynamic dns. Post your code.
21  Using Arduino / Networking, Protocols, and Devices / Re: I2C scanner finds devices but not I2C bus (??) on: July 27, 2014, 07:16:40 am
How long are the wires from the Arduino to the device? They should be as short as possible.
22  Using Arduino / Project Guidance / Re: Arduino UNO + Ethernet Shield + Temperature Sensor + Apache Server + SQL + PHP on: July 26, 2014, 06:57:28 am
Your network settings are not correct. The gateway is unreachable.

Also, you can't use for the server. Use the IP of the server instead. Insure you have modified the server firewall to allow port 80 access from the localnet.

You should read the response from the server. That might help you debug your sketch.
23  Development / Other Software Development / Re: ethernet pings but webclient is not responding on: July 25, 2014, 11:36:55 am
OK, try these additions to your code. Also you might want to use the F() function to reduce your SRAM requirement. I added the F() function to the first few serial and client prints as examples, but I recommend using that on all your static strings.
void listenForEthernetClients()
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client)
    Serial.println(F("Pedido de HTML / Consulta"));   
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected())
      if (client.available())
        char c =;
        // if you've gotten to the end of the line (received a newline character) and the line
        // is blank, the http request has ended, so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
            // Envio da resposta           

// Add this. If you don't see this, then you are not getting a blank line from the client
              Serial.println(F("Sending response"));

              client.println(F("HTTP/1.1 200 OK"));
              client.println(F("Content-Type: text/html"));
              // meta tag -> Faz refresh ao browser de 20 em 20 segundos
              // client.println(F("<meta http-equiv=\"refresh\" content=\"120\">"));
              // print the current readings, in HTML format:
              client.print("<table align=center width=100%><tr><td>Identificacao do sistema </td><td>Brimarel-001</td><td>");
              client.print( "  Ciclo : </td><td>" );
              client.print( String(ciclo) );
              client.print("<table border=1 align=center width=100%><tr><td>Temperatura(TE)</td><td>Humidade(HU)");
              client.print("</td><td>Nivel do Tanque(NT)</td></tr><tr><td><div id='TE'>");                   
              client.print( String(Temperatura));
              client.print("</div></td><td><div id='HU'>");
              client.print( String(Humidade) );
              client.print("</div></td><td><div id='LU'>");
              client.print("</div></td><td><div id='NT'>");
              // Informação de controlo             
              client.print(" Distancia : ");
              client.print(" - Pin ");
              client.print(" ligado a : ");
              client.print(" Stibs");
              // Informação de Controlo             
         // Fim da resposta
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
    // give the web browser time to receive the data
    // close the connection:

// Add this. If you don't see this, then you are not finishing the response send to the client
Then run the sketch again and post the last message on the serial monitor when the server quits responding.
24  Using Arduino / Project Guidance / Re: Ethernet Library on: July 25, 2014, 08:22:26 am
I am using a Freetronics Ethermega and use all of its functionality including interupts, ethernet, SD card, etc.


Catweazle NZ
You do not call any ethernet functions in the ISR function, do you? Many ethernet functions require the delay() function, and it doesn't work while in an ISR.

edit: At least last time I checked. If this is not correct, please let me know.
25  Development / Other Software Development / Re: ethernet pings but webclient is not responding on: July 25, 2014, 07:53:21 am
Is this the last thing displayed on the serial monitor when it stops responding?
Pedido de HTML / Consulta

Networking would have been a better place to post this thread.
26  Using Arduino / Programming Questions / Re: Gsm shield and SD card on: July 25, 2014, 07:38:27 am
It appears you may be running out of SRAM. The symptoms could range from garbage on the serial monitor to a reboot of the Arduino.

Try adding this function and call it before calling each device setup function.
int freeRam() {
  extern int __heap_start,*__brkval;
  int v;
  return (int)&v - (__brkval == 0 ? (int)&__heap_start : (int) __brkval);  

edit: Then use it like this:
Serial.print(F("Free RAM: "));

It will not show zero if you run out of SRAM. It will show a negative or an unrealistic large value.
27  Using Arduino / Networking, Protocols, and Devices / Re: GSM.h and WiFi.h conflict on: July 25, 2014, 07:18:40 am
I don't use those together, but it seems they both use pin D7. The GSM uses D7 for its reset, and the WiFi uses D7 for its handshake pin. I don't know how you are going to fix that.
28  Using Arduino / Networking, Protocols, and Devices / Re: wifi udp write is truncating packets to 29 bytes on: July 24, 2014, 03:09:57 pm
I send 48 bytes all the time. 64 bytes works good for me. I use the WiFiUdpNtpClient sketch in the WiFi examples as a test. It sends and receives 48 byte packets, at least the last time I checked.

How are you determining it is sending only 29 bytes?

edit: Are you still using wireshark to determine that?

29  Using Arduino / Networking, Protocols, and Devices / Re: wifi udp write is truncating packets to 29 bytes on: July 24, 2014, 01:49:19 pm
The limit is around 90 bytes if you have upgraded the firmware.

Have you upgraded the wifi shield firmware?
30  Using Arduino / Networking, Protocols, and Devices / Re: ethernet connect request message issue on: July 24, 2014, 01:08:26 pm
I don't put any SPI device calls in in interrupt handler. Many require interrupts to be enabled for timing.

I don't call any Serial functions in the interrupt handler either.
Pages: 1 [2] 3 4 ... 393