1
\$\begingroup\$

I'm in need of a little guidance in a project I'm working on.

Basically, I'll be using two arduinos:

The first one will have:

The Second one will have

As you can probably figure, what I want to do is read some data from the sensor in the second arduino, transmit it over RF, receive it and send it to a server in the web.

I'm having some trouble deciding what approach to take in sending via Web and receiving the data over RF. I'll need to constatly listen to the receiver, and If I receive a message then send it. I thought about coding a Linked List, and "storing" the values of the sensed data, and then send a http request for each object in the list until it is empty. But what if I receive another read from the sensor while I'm sending the message? What way would be best to send the data over the arduino Ethernet Shield and still be able to get the messages from the RF receiver?

I thought about interrupts, but I have no idea how it would behave while reading the response of the HTML request, as most examples use millis() and delay functions.

\$\endgroup\$
2
\$\begingroup\$

Interrupts on the ethernet shield are not supported by stock library. (don't think anyone has gotten it to work). Noting the RF Link is a receiver and will be connected to the RX of the Serial. The Arduino's Serial Library will collected this using interrupts (per byte) into the Serial Buffer, to be read by your application. So as long as the Serial Data does not exceed the rx buffer between reads, your main loop simply need to service both objects... inByte = Serial.read(); building your string, then when you so desire send client.print what you want to your destination. Neither of these read or prints are blocking.

Look at the example ..\libraries\Ethernet\examples\TelnetClient\TelnetClient.ino

Where you can add framing of the serial listened data and then putting the desired results to a wput. as done in example ..\libraries\Ethernet\examples\PachubeClientString\PachubeClientString.ino

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.