Relay8 demo program

All about the Raspberry Pi SBC and Rpi projects,hints, etc.

Relay8 demo program

Postby Richard-TX » Thu Sep 11, 2014 10:43 am

#!/bin/sh
echo "what I2C bus? (0 or 1)"
read BUS

echo "What I2C address? (nn)"
read ADDR

#set PORT B as output
i2cset -y $BUS 0x$ADDR 0x01 0x00
echo "turning on all relays"
i2cset -y $BUS 0x$ADDR 0x13 0xff
sleep 1
echo "turning off all relays"

i2cset -y $BUS 0x$ADDR 0x13 0x00
sleep 1
echo "sequencing all relays"
for a in 1 2 4 8 10 20 40 80
do
i2cset -y $BUS 0x$ADDR 0x13 0x$a
sleep 1
done

echo "all done"
i2cset -y $BUS 0x$ADDR 0x13 0x00
User avatar
Richard-TX
Site Admin
 
Posts: 208
Images: 6
Joined: Sat Feb 04, 2012 8:10 pm

Re: Relay8 demo program

Postby Richard-TX » Sun Sep 21, 2014 10:11 pm

while true
do
for a in 1 2 4 8 10 20 40 80
do
i2cset -y 1 0x26 0x12 0x$a
sleep 0.1
i2cset -y 1 0x26 0x13 0x$a
sleep 0.25
done
sleep 0.25
i2cset -y 1 0x26 0x12 0xf0
sleep 0.25
i2cset -y 1 0x26 0x12 0x0f
sleep 0.25
i2cset -y 1 0x26 0x12 0x00
#sleep 0.25
i2cset -y 1 0x26 0x13 0xf0
sleep 0.25
i2cset -y 1 0x26 0x13 0x0f
sleep 0.25
i2cset -y 1 0x26 0x13 0x00
done
User avatar
Richard-TX
Site Admin
 
Posts: 208
Images: 6
Joined: Sat Feb 04, 2012 8:10 pm


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 1 guest

cron