Show Posts
Pages: 1 ... 10 11 [12] 13 14
166  Using Arduino / Programming Questions / Re: HTTP client - Interactive Matter on: June 16, 2011, 08:39:04 am
Thank you PaulS,

I was so rapped up in my problem, i didn´t even explained what i was expecting.

Mainly i was expecting to get the same answer over and over again. Basically i only receive the correct answer on the first cycle, after i just get the OK.
And i don´t really understand why... I thought the reason could be related with the misuse of the File stream result but i´, not sure.

Can i do more to help on the debug?
Just tell me, maybe other prints
Throw ideas at me please

Cheers
167  Using Arduino / Programming Questions / HTTP client - Interactive Matter on: June 15, 2011, 10:18:30 am
Hi,

I´m using the HTTP Client form - interactive Matter : http://interactive-matter.eu/how-to/arduino-http-client-library/

And i´m having problems with the simplest thing...
I created a Webserver in my PC with iWeb Server, and its serving a txt file.

When i run this client code in my arduino i get the following:
The code has nothing special...

Code:
void loop(){

  char a = '0';

delay(3000);

  //AQUISITION FILE RETRIEVAL
  /////////////////////////////

  Client client(testip, 80);    

  if ( client.connect() ){

    Serial.println("Entrou no connect");

    HTTPClient client("stuff.com", testip, 80);
    FILE* result = client.getURI("/default.html");

      fgets(streami,100,result);
    
    int returnCode = client.getLastReturnCode();
    if (result!=NULL) {      
      client.closeStream(result);
      Serial.println("Closing stream");
      
      Serial.println(streami);      
    }
    else {
      Serial.println("Failed to connect");
    }
    if (returnCode==200) {
      Serial.println("Data uploaded");
    }
    else {
      Serial.print("ERROR: Server returned ");
      Serial.println(returnCode);
    }

  }
  else{
    Serial.println("ERROR: No connect ");
  }

  client.stop();

}

Streami is an 300 character string.


I Get the following response in the Serial window:

Quote
Serial port 0 initialized...
Ethernet initialized...
SD card initialized...
Entrou no connect
Closing stream
"[{\"b_formula\"smiley-mad,\"address\"smiley-mad,\"format\":\"sint32\",\"inverted\":true,\"method\":\"ir\",\"uuid\"
Data uploaded
Entrou no connect
Closing stream
 OK

Data uploaded
Entrou no connect
Closing stream
 OK

Data uploaded
Entrou no connect
Closing stream
 OK

Data uploaded



I think the problems resides in some memory problem that i´m not detecting.
Something related with the use of file streams.
Can some someone give ideas about what might be the problem?

Thank you!
168  Using Arduino / Programming Questions / Re: WiFly library and Ethernet Shield library what to do ? on: June 15, 2011, 09:55:59 am
Hi,

In the meanwhile i did that.

But i´m having problems with some buffering, i don´t know yet...
169  Using Arduino / Programming Questions / WiFly library and Ethernet Shield library what to do ? on: June 06, 2011, 09:16:26 am
Hi,

I was using the Ethernet library from Arduinos core libraries to do some ethernet stuff (NTP synchronization, HTTP request, etc...)

But right now i want to use the HTTPclient from http://interactive-matter.eu/how-to/arduino-http-client-library/ Interactive Matter.

But in the last updates of this library, they started using the WiFly library as way to control the ethernet and wireless hardware of arduino.
In the WiFly library they say this, and i quote:
Quote
The goal with this library is to make it--as much as possible--a "drop in" replacement for the official Arduino Ethernet library.
http://forum.sparkfun.com/viewtopic.php?f=13&t=21846
http://forum.sparkfun.com/viewtopic.php?f=32&t=25216

i wanted to know, how should i proceed to substitute the actual Ethernet library for the Wifly library.
Is it transparent? What should i be expecting and what cares should i take?

Does anyone know?

Cheers
170  Using Arduino / Programming Questions / Metro library on: June 03, 2011, 08:39:39 am
Hi,

Does anyone knows if the Metro library let´s you initialize more then one variable of the type Metro?

http://www.arduino.cc/playground/Code/Metro

Cheers
171  Using Arduino / Programming Questions / Re: Reading a file from SD within a directory on: May 31, 2011, 12:45:35 pm
Hey PaulS !

Sorry for me being such a lazy ass smiley

Thank you for the help
172  Using Arduino / Programming Questions / Re: Reading from file and instantly writting to an HTTP client on: May 31, 2011, 12:44:29 pm
Yap, makes sense!

Thank you
173  Using Arduino / Programming Questions / Re: Interrupts and Serial Port on: May 31, 2011, 12:42:17 pm

Man you are persistent smiley

I can´t really remember a real world application but imagine the absurd of a one letter code "A".

The only real reason i´m seeing for using interrupts, is for example if you have a really big sketch of code, that takes really long to be executed.
You might end up having timeout in the comunications, if the block of code takes more then 3 seconds to execute or something, and you don´t reply in time.

But in this case you can put some line of code to check the serial data, in the middle of the really big block of code, so ...

I´m sure there should be some crazy use for the interrupts smiley , but in the major part i´m with you on this

Cheers
174  Using Arduino / Programming Questions / Re: Reading a file from SD within a directory on: May 31, 2011, 05:32:39 am
It´s not working

Tried this:

Code:
myFile = SD.open("wcfg\\intro.txt", FILE_READ);

and this:

Code:
myFile = SD.open("\\wcfg\\intro.txt", FILE_READ);

Do you have any idea what might be the mistake.
The code works if i put the file in the root...
175  Using Arduino / Programming Questions / Re: Interrupts and Serial Port on: May 31, 2011, 05:15:21 am
There are some cases where it could be useful and feasible.

For example if you use very small codes like "ATK". You can use the serial port in assynchronous way (interrupt driven behaviour) and might not need to check constantly for new characters, since you already know your codes are small.
176  Using Arduino / Programming Questions / Reading a file from SD within a directory on: May 31, 2011, 05:05:41 am
Hi,

I´am having problems acessing the files within directories for reading.

How should i do this:

Code:
myFile = SD.open("wcfg\intro.txt", FILE_READ);

The problem is in the backslash on the middle or the need for backslash in the beginning.
Does someone know how to put this expression correctly?

Cheers
177  Using Arduino / Programming Questions / Re: Interrupts and Serial Port on: May 31, 2011, 04:52:18 am
Mainly i was trying to satisfy my curiosity and understand better the library.

As i said before:

Quote
I´m going to take into consideration what you said, maybe i don´t really need it

 smiley

Cheers
178  Using Arduino / Programming Questions / Re: Reading from file and instantly writting to an HTTP client on: May 31, 2011, 04:27:24 am
Sorry i made a mistake:

This is the correct way to put the problem:

Does anyone has any idea why this code doesn´t work:

Code:
while (myFile.available()) {  
              client.print(myFile.read());
            }


and this works:

Code:
while (myFile.available()) {
              a = myFile.read();
              client.print(a);
            }

(variable a, is a char)

Cheers
179  Using Arduino / Programming Questions / Re: Interrupts and Serial Port on: May 31, 2011, 04:24:10 am
Hi Dave,

If i understood right the buffering of the Data on the software side is done seamlessly by interrupt? Is that it.

But if this is the case i continue to have the same problem (you only avoid exceeding the maximum serial port buffering capacity) you still don´t have the capacity of responding instantly to some request on the serial port, unless you constantly check for new data on your software buffer.

Right? Or am i seeing it wrong?

Cheers
180  Using Arduino / Programming Questions / Reading from file and instantly writting to an HTTP client on: May 30, 2011, 12:19:31 pm
Hi,

Does anyone has any idea why this code works:

Code:
while (myFile.available()) {  
              client.print(myFile.read());
            }


and this one doesn´t:

Code:
while (myFile.available()) {
              a = myFile.read();
              client.print(a);
            }

(variable a, is a char)

Cheers
Pages: 1 ... 10 11 [12] 13 14