-2

I am thinking of using a Raspberry Pi for controlling some hardware. The first of which is an actuator that a push button would rotate one direction, then a second push rotates it back.

The second script would be for keeping the unit cool: I am thinking of a thermal sensor that would then activate a fan to cool the project box that everything will be in.

And possible third and fourth applications (possibly more push buttons so first script would do it)

Can two (or more) scripts be running at the same time?

techraf
  • 4,319
  • 10
  • 31
  • 42
  • 1
    The Pi (like most Linux machines) has over 50 processes running at one time (mine currently has 182). You can potentially run 1000, the only real limit is memory. PS Don't waste your time running fans, with or without a sensor - they are not needed (unless you find the noise reassuring). – Milliways Dec 15 '16 at 05:55

1 Answers1

1

In short, yes. Any modern operating system can multi task so it can run lots of processes at the same time, for instance in Rasbian you can have multiple instances of the terminal open as well as the web browser all at once. You can also run scripts in the background by adding & to the end of the line on the terminal which allows you to run multiple scripts from that terminal e.g.:

$ ./my_script.sh &

For your application, depending what language you're writing this in, it may be neater to only use one threaded program allowing for different functions to run simultaneously in your program. Or alternatively have a main function which controls the cooling element and then set up an Interrupt Service Routine which runs every time the button is pressed.

pfl
  • 341
  • 1
  • 6