Show Posts
Pages: 1 2 [3] 4 5 ... 390
31  Using Arduino / Interfacing w/ Software on the Computer / Re: How to add .js and .css files in a arduino-SD card hosted website ? on: July 15, 2014, 03:41:59 pm
You are probably correct. Your code seems to be faulty. Here is the section of code with the problem. If the request contains the string "ajax_inputs", it sends a header and the XML stuff. Otherwise, it sends a header and the index.htm file. The js files are not sent correctly. They would be sent after the index.htm file.
Code:
          if(StrContains(HTTP_req, "ajax_inputs")){
            //send rest of HTTP header
            client.println("Content-Type: text/xml");
            client.println("Connection: keep-alive");
            client.println();
            //send XML file containing input states
            //Serial.println("XMP_RPM_MPH(client)");
            XML_RPM_MPH(client);
          }

          else {  //web page request
            //send rest of HTTP header
            client.println("Content-Type:text/html");
            client.println("Connection: close");
            client.println();
            //send web page
            Serial.println("Sending Index.htm");
            webFile = SD.open("index.htm");    //open web page file
            if(webFile){
              while(webFile.available()){
                client.write(webFile.read());  //send web page to client
              }
              webFile.close();
            }
The "else" should be an "if(StrContains(HTTP_req, "index.htm"))".
32  Using Arduino / Networking, Protocols, and Devices / Re: Problems with UDP on: July 15, 2014, 01:27:54 pm
Apology for the delay in my answer, but I was surfing.

If Udp.endPacket() hangs, it is probably because it is having trouble delivering the packet. Does it hang forever, or just for a while?

Even though the reference documentation does not specify a return value for Udp.endPacket(), it does return a value. It returns 1 if the packet was sent to the:
1) device if the destination device is localnet,
or
2) gateway if the destination device is not localnet,

or 0 if it wasn't sent.

Use this to determine the status of the send:
Code:
if(!Udp.endPacket()) Serial.println(F("packet send failed"));
else Serial.println(F("packet sent ok"));
The 1 return value does not indicate the packet reached its destination, just that the first device en route to the destination device took the packet.
33  Using Arduino / Project Guidance / Re: Arduino udp and processing udp on: July 15, 2014, 10:47:31 am
Bear in mind that 'A' (0x41) does not equal 'a' (0x61).
34  Using Arduino / Networking, Protocols, and Devices / Re: Problems with UDP on: July 14, 2014, 10:02:47 am
So from what I read, the Arduino is receiving packets from the Mac, but no packets received on the Mac? If so, check the Mac firewall.
35  Using Arduino / Programming Questions / Re: convert string to int on: July 14, 2014, 08:32:36 am
There is a difference between string (character array) and String (data type). atoi accepts only the character array type.
36  Community / Website and Forum / Re: Nick Gammon on: July 14, 2014, 08:17:14 am
Thanks, John. I guess you may be correct. I miss his contributions here.
37  Using Arduino / Programming Questions / Re: Ethernet Shield connection issue on: July 14, 2014, 08:08:52 am
I usually check the dhcp server address pool in the router. I use an IP within the localnet but outside that pool. No duplicate IPs on that localnet allowed. My routers are fault tolerant about that, but some aren't. Some routers will not recognize or communicate with an IP in the dhcp range if it did not issue that ip.
38  Community / Website and Forum / Nick Gammon on: July 14, 2014, 08:01:29 am
Anybody know what happened to Nick Gammon? I have not seen a post since February. I tried to send a PM to him to see if he was ok, but got this message when I tried:
Quote
User 'Nick Gammon' has blocked your personal message.

I still use his "blink without delay" code. I miss reading his stuff.
39  Using Arduino / Programming Questions / Re: convert string to int on: July 14, 2014, 07:12:08 am
What is difficult about atoi?
Code:
char myCharInt[] = "49";
int myInt = atoi(myCharInt);
40  Using Arduino / Networking, Protocols, and Devices / Re: AdaFruit CC3000 tutorial connection error on: July 14, 2014, 06:34:49 am
The server is reporting a PHP parse error, not a connection error. This is line 7 in that file.
Code:
$myFile = “/~Peder/wifi-weather-station/temp_data.txt";
The file location is probably not correct. Use the local directory path, not the Apache path.

edit: I did not notice the leading double quote is not correct until I posted line 7 here. Do you notice it is different than the trailing double quote? They should look the same.

You did not post the entire Apache access log, but I will presume the status code returned was "500 - Internal Server Error".
41  Using Arduino / Programming Questions / Re: Ethernet Shield connection issue on: July 14, 2014, 06:19:17 am
You cannot use an IP that is already in use. Do not use the IP of the computer's network adapter on the Arduino.

You cannot use a mac address that is already in use.

42  Using Arduino / Programming Questions / Re: Ethernet Shield connection issue on: July 13, 2014, 10:38:56 am
From a command prompt on the Windows computer, enter ipconfig. It will display the network settings for all network devices.
http://en.wikipedia.org/wiki/Ipconfig
43  Using Arduino / Programming Questions / Re: Ethernet Shield connection issue on: July 13, 2014, 07:47:43 am
Connecting the ethernet cable to your computer may be the problem. Do you have the ethernet port on the computer set up to use that same localnet network settings?
44  Using Arduino / Programming Questions / Re: How can Serial.print() affect my sketch's logic? on: July 13, 2014, 07:38:40 am
The only time I have seen fails like this is due to interrupts or lack of SRAM, but I don't see where you are using that much SRAM in your sketch.

Have you tried the F() function as a test? I would try it with all your static strings to see if that helps.
Code:
  Serial.println(F("1234567890123")); //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
45  Using Arduino / Programming Questions / Re: How can Serial.print() affect my sketch's logic? on: July 13, 2014, 07:22:21 am
Where did you get the Bounce2 library? Does it use interrupts? The Serial functions use interrupts. Have you tried your code without the Bounce2 library?
Pages: 1 2 [3] 4 5 ... 390