Project to various input

Hello

I have several questions on how the Arduino works to implement a project.

I need to control outputs, with commands coming through the ethernet or input pin at the same time.
Without multi threading in arduino is possible?
or
is easy to implement multi threading in arduino for the tasks mentioned above?

Pressure switch as input works fine in Arduino or give boucing problem?

If the aim is to read the various inputs binary (5V or 0V), can have multiple inputs connected to GND smoothly to the arduino?

Thanks

I need to control outputs, with commands coming through the ethernet or input pin at the same time.
Yes, within the context of non-instantaneously; multiple instructions would be required and each instruction is in the order 4uS per instruction.

Without multi threading in arduino is possible?
There is no (true) multi threading; the concept is foreign to Arduino.

or
is easy to implement multi threading in arduino for the tasks mentioned above?
No, you could however implement a lightweight kernel that would provide semaphores and scheduling: Google: RTOS+Arduino.

Pressure switch as input works fine in Arduino or give boucing problem?

You will need to implement external hardware or software debouncing.

If the aim is to read the various inputs binary (5V or 0V), can have multiple inputs connected to GND smoothly to the arduino?

The input pins can swing between 0 (ground) and no higher than 5?5V if the uC is driven by 5.0V.
Such questions obviously are answered in the related Atmel uC data sheet.

Ray

Thank you very much.

To avoid having to buy capacitors I'll solve the problem by boucing software.

It is not critical the response time of the system, but it can not lose the commands that are received.

So I do not need to apply multi thread, just needed the interrupts practically what does not work very well in RTOS for arduino.

To read the ethernet port is a blocking function?
For example when I do: char c = client.read ();

or is run the instruction "While" while not comes a message by ethernet?
The code:

while (client.connected ()) {
       if (client.available ()) {
         client.read char c = ();
         ...
    }
}

I do not have an arduino to test, I want to know if it works for this task before buying.

If not my solution will be to use the raspberry pi.

Thanks

I am not familar with the ethernet stuff for Arduinos but, in general WHILE loops are blocking and should be avoided if blocking is a problem. I presume you can check if there is a character available and read it without needing blocking code.

The simple solution to pseudo parallel actions on the Arduino is the technique used in the Blink Without Delay example sketch. I wrote an extended demo of it in the first post in this Thread.

You can download and explore the Arduino IDE without needing an Arduino board - though of course you can't run any programs (sketches).

...R

Thank you Robin2

If client.read function is non-blocking, I insert inside the while checking the status of each entry. If the function is blocking not know how to do.

The problem with using the IDE, I may be able to compile the code but do not know if it correct work.

I will study this solution "Blink Without Delay."

Thanks

Is there a client.available() function that is equivalent to Serial.available() which tells you how many characters are waiting in the Serial input buffer?

...R

Thank you

It was a big help, I get that it is possible and how I have to do.

:slight_smile: