At work we want to use a Raspberry Pi to control a series of air bladders.
They have to work in sequence.
For example. Turn one on, wait 1 min and turn the next one and so on.
How can you program the Pi to do it.
I am thinking on a cron job but command line is not my thing.
Can someone point me to the right direction or tell me how?
Raspberry Pi timer controller
Moderators: b1o, jkerr82508
Re: Raspberry Pi timer controller
Well you could do something like this:
This one is going to write valhalla!!! every minute - forever (as long as the counter is 0)
You can change sleep 60 to sleep 5 to test it a bit faster.
Save it as berserk.sh and chmod it to 777 and start the script with ./berserk.sh
But this is b1o stuff...
b1o !!!
#!/bin/bash
COUNTER=0
while [ $COUNTER -eq 0 ]; do
sleep 60
echo valhalla!!!
done
This one is going to write valhalla!!! every minute - forever (as long as the counter is 0)
You can change sleep 60 to sleep 5 to test it a bit faster.
Save it as berserk.sh and chmod it to 777 and start the script with ./berserk.sh
But this is b1o stuff...
b1o !!!
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"
"There are no stupid questions - Only stupid answers!"
Re: Raspberry Pi timer controller
Thanks.
How do I start it with a push of a single button?
My other idea was a pressure cascade system.
How do I start it with a push of a single button?
My other idea was a pressure cascade system.
Re: Raspberry Pi timer controller
Have a look here:
Here I have made a sequence script:
It will pump on bladder one for 6 sec then two for 6 sec then bladder three for 6 sec before starting with bladder one again ...
Just change 6 to 60 and you will have your one minute sequences.
Here I have made a sequence script:
Code: Select all
#!/bin/bash
for (( ;; ))#starts infinite loop
do
COUNTER=0
COUNTER2=0
COUNTER3=0
while [ $COUNTER -lt 6 ]; do #pumps continuously into bladder one for 6 sec
sleep 1
echo Pumping bladder one... $COUNTER
let COUNTER=COUNTER+1;
done
while [ $COUNTER2 -lt 6 ]; do #pumps continuously into bladder two for 6 sec
sleep 1
echo $COUNTER2
echo Pumping bladder two!
let COUNTER2=COUNTER2+1
done
while [ $COUNTER3 -lt 6 ]; do #pumps continuously into bladder three for 6 sec
sleep 1
echo Pumping bladder three! $COUNTER3
let COUNTER3=COUNTER3+1
done
done #"End" of infinite loop
It will pump on bladder one for 6 sec then two for 6 sec then bladder three for 6 sec before starting with bladder one again ...
Just change 6 to 60 and you will have your one minute sequences.
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"
"There are no stupid questions - Only stupid answers!"