Show Posts
Pages: 1 ... 51 52 [53] 54 55 ... 142
781  Community / Bar Sport / Nice little touch. on: November 24, 2013, 04:02:48 am
Nice subtle touch to the forums! (see attached image).
Of course this posts ruins it though.


EDIT: Haha, maybe not, Bar Sport isn't included in post count.
782  Using Arduino / Networking, Protocols, and Devices / Re: HTTP header lines delineated with \r\n or just \n or \r? on: November 24, 2013, 03:33:37 am
No worries, I didn't actually know the answers, but as I've just started coding my server I wish it to be correct too, so answering these types of questions will benefit me just as much, assuming too much always leads to some kind of bug/error down the track.

Here is the link I forgot to post (location of referenced text above)
http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html

And the main reference index:
http://www.w3.org/Protocols/rfc2616/rfc2616.html  << Worth browsing through on a rainy day.
783  Using Arduino / Project Guidance / Re: controlling arduino over wifi from outside my LAN on: November 24, 2013, 02:47:30 am
You should look up the manual for your router and add 'port forwarding' for your arduino's IP & port.
This will allow an internal port accessible from an external address ( internet ).

Or you could try and use/modify this UPNP ( automatic port forwarding ) code for the wifi:
https://github.com/deverick/Arduino-Upnp-PortMapping

Upnp is especially useful if you do not want a static IP/rely on DHCP/or might not know the custom static IP (user set).
784  Using Arduino / Networking, Protocols, and Devices / Re: HTTP header lines delineated with \r\n or just \n or \r? on: November 24, 2013, 02:20:14 am
No, don't add crlf after the message body.

Quote
4.1 Message Types

HTTP messages consist of requests from client to server and responses from server to client.

       HTTP-message   = Request | Response     ; HTTP/1.1 messages
Request (section 5) and Response (section 6) messages use the generic message format of RFC 822 [9] for transferring entities (the payload of the message). Both types of message consist of a start-line, zero or more header fields (also known as "headers"), an empty line (i.e., a line with nothing preceding the CRLF) indicating the end of the header fields, and possibly a message-body.

        generic-message = start-line
                          *(message-header CRLF)
                          CRLF
                          [ message-body ]
        start-line      = Request-Line | Status-Line
In the interest of robustness, servers SHOULD ignore any empty line(s) received where a Request-Line is expected. In other words, if the server is reading the protocol stream at the beginning of a message and receives a CRLF first, it should ignore the CRLF.

Certain buggy HTTP/1.0 client implementations generate extra CRLF's after a POST request. To restate what is explicitly forbidden by the BNF, an HTTP/1.1 client MUST NOT preface or follow a request with an extra CRLF.
785  Using Arduino / Networking, Protocols, and Devices / Re: HTTP header lines delineated with \r\n or just \n or \r? on: November 23, 2013, 11:32:13 pm
Not sure so I had a browse, seems '\r\n' is correct:

From wikipedia
Quote
The header fields are transmitted after the request or response line, which is the first line of a message. Header fields are colon-separated name-value pairs in clear-text string format, terminated by a carriage return (CR) and line feed (LF) character sequence. The end of the header fields is indicated by an empty field, resulting in the transmission of two consecutive CR-LF pairs. Long lines can be folded into multiple lines; continuation lines are indicated by the presence of a space (SP) or horizontal tab (HT) as the first character on the next line.[1]

http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
786  Using Arduino / Programming Questions / Re: Memory and SD library problem on: November 23, 2013, 11:28:06 pm
You should try sdFat, it is a new and improved SD.h https://code.google.com/p/sdfatlib/

Both implementations of the SD library use at least a 512 byte buffer. Analyse your variable usage and see what you can do more efficiently, don't use Strings if you are currently, make int's the smallest size you can.

Post your code for quality help, I'm sure your problem can be solved trivially.
787  Using Arduino / Networking, Protocols, and Devices / Re: RF24: one loop takes 30ms :( on: November 23, 2013, 08:24:52 pm
Maybe there are lots of errors and the packets are re-sent, if the RF24 doesn't return until sent, then errors could slow things down. I'm starting to use these modules so I'll have a peek in the library code.

Just out of curiosity, have you tried using the radio at a higher speed ( RF24_2MBPS ). And quite possibly a faster SPI speed.
788  Using Arduino / Programming Questions / Re: manually parse json on: November 22, 2013, 05:16:16 am
You cannot assign to arrays, only initialise them.

If you want to initialise the array you could do this:

Code:
char cadena_temperatura[255] = { "{\"SENSOR_ID\":\"ID_SEN\",\"H_DEV\":\"H_DISPOSITIVO\",\"H_SENSOR\":\"H_SEN\",\"DESCRIPTION\":\"DESCTEMP\",\"ACCESS\":\"ACCESSTEMP\",\"VALOR\":temperatura,\"MIN01\":tmin,\"MAX01\":tmax,\"PERIODO\":PERIOD,\"UNITS\":\"UNITSTEMP\"}" };

In this code, ID_SEN, H_DISPOSITIVO and H_SEN aren't variables, they are just text in the string. More of a task ahead if you want the arrays contents in their place.
789  Using Arduino / Programming Questions / Re: Moving Functions to External Libraries on: November 22, 2013, 04:50:08 am
Quote
I might want to recompile to only bring in c.cpp and d.cpp  I don't want to load a/b/c/d.cpp at the same time if main.cpp only needs c.cpp and d.cpp.

Your sketch should only be including header files, there are only select reasons why one would need to control/include the cpp files. The library header that your sketch includes should contain or include the same headers the cpp files require.

The compiler will see what you aren't using and leave it out of the final product. What you want probably isn't needed for your situation, and is very difficult to achieve without templates as the library source files are compiled before your sketch so no compile time flag in the sketch will make a difference. What needs to happen essentially is the library must require something from the sketch effectively postponing the compilation. And the process may be far more involved that what your library is.
790  Using Arduino / Programming Questions / Re: Moving Functions to External Libraries on: November 21, 2013, 12:59:22 am
explain more, do you wan't the data that is not flagged in the global to be left out when compiled?

Or do you wish to set a flag (during runtime) which specifies which data set to use, and this selection can be changed (at runtime)?
791  Using Arduino / Programming Questions / Re: Moving Functions to External Libraries on: November 20, 2013, 08:57:21 pm
using the same extern approach posted above, or use a class with static members:

A.h
Code:
#ifndef HEADER_A
  #define HEADER_A
  class MyGlobals{
    public:
      static char myArr[ 5 ];
  };
#endif

A.cpp
Code:
#include "A.h"
char MyGlobals::myArr[ 5 ] = { 1,2,3,4,5 };

Then include A.h in your other headers/cpp files and access like:
Code:
char c = MyGlobals::myArr[ 0 ];
//c = 1

For less SRAM use look as storing data in PROGMEM ( forum search will find loads of info )
792  Using Arduino / Storage / Re: string format in SD card library on: November 20, 2013, 08:01:23 pm
A simple cast should fix:

Code:
File.write( ( uint8_t* ) &datasensor[0], datasensor.length() );

&datasensor[0] returns a char*, the function just needs its unsigned counterpart. ( unsigned char == uint8_t )
793  Using Arduino / Networking, Protocols, and Devices / Re: about connecting to Arduino Server with Ethernet through Processing on: November 20, 2013, 07:42:07 pm
I personally think  a web page is a far better medium for remote control, web technologies are very flexible and powerful these days. I haven't used processing so I'm not much help, however I did find this: http://processing.org/reference/libraries/net/
794  Using Arduino / Networking, Protocols, and Devices / Re: about connecting to Arduino Server with Ethernet through Processing on: November 20, 2013, 07:17:35 pm
If you are using the mega as a server, why not have it as aweb server and provide a config page to a browser, rather than trying to connect to processing.

Javascript and ajax will allow you to talk to the Arduino from the web page.

As a web page you can even use your phone to control the Arduino.
795  Using Arduino / Networking, Protocols, and Devices / Re: Thumbs way down for Arduino WiFi shield. Read before you buy on: November 20, 2013, 07:04:44 pm
The FLASH string helper F() uses String object to allocate memory so it takes more SRAM. The write(char*) simply calls write(char) repeatedly.

No it does not!

F(), uses PSTR
Code:
class __FlashStringHelper;
#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))

This writes byte by byte to 'write'.
Code:
size_t Print::print(const __FlashStringHelper *ifsh)
{
  const char PROGMEM *p = (const char PROGMEM *)ifsh;
  size_t n = 0;
  while (1) {
    unsigned char c = pgm_read_byte(p++);
    if (c == 0) break;
    n += write(c);
  }
  return n;
}
Pages: 1 ... 51 52 [53] 54 55 ... 142