uSD Breakout
#30
                        


PIN-setup.sh
Code:
#!/bin/sh
echo 160 > /sys/class/gpio/export
echo 161 > /sys/class/gpio/export
echo 162 > /sys/class/gpio/export
echo 163 > /sys/class/gpio/export
echo 164 > /sys/class/gpio/export
echo 165 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio160/direction
echo out > /sys/class/gpio/gpio161/direction
echo out > /sys/class/gpio/gpio162/direction
echo out > /sys/class/gpio/gpio163/direction
echo out > /sys/class/gpio/gpio164/direction
echo out > /sys/class/gpio/gpio165/direction

example:  ./PIN-setup.sh

LED.sh
Code:
#!/bin/sh
echo $2 > /sys/class/gpio/gpio$1/value

example:  ./LED.sh  <gpio>  < 0|1 >     ./LED.sh  160  1     ./LED.sh  160  0

blinker.sh
Code:
#!/bin/sh

COUNTER=0
while [ $COUNTER -lt $2 ]; do
  echo 1 > /sys/class/gpio/gpio$1/value
  sleep .35
  echo 0 > /sys/class/gpio/gpio$1/value
  sleep .65
  COUNTER=$(($COUNTER+1))
done

example:  ./blinker.sh  <gpio> <count>     ./blinker.sh  160  7

led_all.sh
Code:
led_all.sh
#!/bin/sh

./LED.sh 160 $1
./LED.sh 161 $1
./LED.sh 162 $1
./LED.sh 163 $1
./LED.sh 164 $1
./LED.sh 165 $1

example:  ./led_all.sh  < 0|1 >     ./led_all.sh  1     ./led_all.sh  0

blink_all.sh
Code:
#!/bin/sh

./led_all.sh 1
sleep .256
./led_all.sh 0
sleep .256

example:  ./blink_all.sh

flasher.sh
Code:
#!/bin/sh

COUNTER=$3
while [ $COUNTER -gt 0 ]
do
    ./LED.sh 160 1
    ./LED.sh 161 0
    ./LED.sh 162 1
    ./LED.sh 163 0
    ./LED.sh 164 1
    ./LED.sh 165 0
    sleep $1
    ./LED.sh 160 0
    ./LED.sh 161 1
    ./LED.sh 162 0
    ./LED.sh 163 1
    ./LED.sh 164 0
    ./LED.sh 165 1
    sleep $1
    if [ "$2" = "1" ]
    then
       COUNTER=$((COUNTER -= 1))
    fi
done

example:  ./flasher.sh  <T_ms>  < 0|1 >  <count>
example:  ./flasher.sh  .047  0  7          (runs continuously)
example:  ./flasher.sh  .047  1  7          (loops only 7 times)

scanner.sh
Code:
#!/bin/bash

COUNTER=$3
while [ $COUNTER -gt 0 ]
do
    ./LED.sh 161 0
    ./LED.sh 160 1
    sleep $1
    ./LED.sh 160 0
    ./LED.sh 161 1
    sleep $1
    ./LED.sh 161 0
    ./LED.sh 162 1
    sleep $1
    ./LED.sh 162 0
    ./LED.sh 163 1
    sleep $1
    ./LED.sh 163 0
    ./LED.sh 164 1
    sleep $1
    ./LED.sh 164 0
    ./LED.sh 165 1
    sleep $1
    ./LED.sh 164 0
    ./LED.sh 165 1
    sleep $1
    ./LED.sh 165 0
    ./LED.sh 164 1
    sleep $1
    ./LED.sh 164 0
    ./LED.sh 163 1
    sleep $1
    ./LED.sh 163 0
    ./LED.sh 162 1
    sleep $1
    ./LED.sh 162 0
    ./LED.sh 161 1
    sleep $1
    ./LED.sh 161 0
    ./LED.sh 160 1
    sleep $1
    if [ "$2" = "1" ]
    then
       COUNTER=$((COUNTER -= 1))
    fi
done

example:  ./scanner.sh  <T_ms>  < 0|1 >  <count>
example:  ./scanner.sh  .047  0  7     (runs continuously)
example:  ./scanner.sh  .047  1  7     (loops only 7 times)

strober.sh
Code:
#!/bin/sh

COUNTER=$3
while [ $COUNTER -gt 0 ]
do
    ./LED.sh 165 0
    ./LED.sh 160 1
    sleep $1
    ./LED.sh 160 0
    ./LED.sh 161 1
    sleep $1
    ./LED.sh 161 0
    ./LED.sh 162 1
    sleep $1
    ./LED.sh 162 0
    ./LED.sh 163 1
    sleep $1
    ./LED.sh 163 0
    ./LED.sh 164 1
    sleep $1
    ./LED.sh 164 0
    ./LED.sh 165 1
    sleep $1
    if [ "$2" = "1" ]
    then
       COUNTER=$((COUNTER -= 1))
    fi
done

example:  ./strober.sh  <T_ms>  < 0|1 >  <count>
example:  ./strober.sh  .047  0  7      (runs continuously)
example:  ./strober.sh  .047  1  7      (loops only 7 times)

strober2.sh
Code:
#!/bin/sh

COUNTER=$3
while [ $COUNTER -gt 0 ]
do
    ./LED.sh 160 0
    ./LED.sh 165 1
    sleep $1
    ./LED.sh 165 0
    ./LED.sh 164 1
    sleep $1
    ./LED.sh 164 0
    ./LED.sh 163 1
    sleep $1
    ./LED.sh 163 0
    ./LED.sh 162 1
    sleep $1
    ./LED.sh 162 0
    ./LED.sh 161 1
    sleep $1
    ./LED.sh 161 0
    ./LED.sh 160 1
    sleep $1
    if [ "$2" = "1" ]
    then
       COUNTER=$((COUNTER -= 1))
    fi
done

example:  ./strober2.sh  <T_ms>  < 0|1 >  <count>
example:  ./strober2.sh  .047  0  7      (runs continuously)
example:  ./strober2.sh  .047  1  7      (loops only 7 times)

demo_LED.sh
Code:
#!/bin/sh

while [ true ]
do
  ./scanner.sh .037 1 $1
  ./flasher.sh .037 1 7
  ./strober.sh .043 1 $1
  ./blink_all.sh
  ./strober2.sh .057 1 $1
  ./flasher.sh .037 1 7
  ./led_all.sh 0
  ./strober2.sh .256 1 1
  ./led_all.sh 0
  sleep .175
  ./strober.sh .256 1 1
  ./led_all.sh 0
  sleep .175
  ./scanner.sh .019 1 $1
  ./flasher.sh .037 1 7
  ./strober.sh .027 1 $1
  ./blink_all.sh
  ./strober2.sh .077 1 $1
  ./flasher.sh .037 1 7
  ./led_all.sh 0
  ./strober.sh .256 1 1
  ./led_all.sh 0
  sleep .175
  ./strober2.sh .256 1 1
  ./led_all.sh 0
  sleep .175
done

example:  ./demo_LED.sh  <count>     ./demo_LED.sh  12       (each section of the demo loops 12 times)



For those of you testing the machinehum uSD Breakout,  the above scripts will give you something right-away to play with using an led_lab ( described below, see pics above ) and your Pinebook.  Place all ten (10) of the scripts above in a working directory on your gnu+linux Pinebook image, and use   sudo -i  to run the demo_LED.sh script ( or any of the other sub-scripts ).  Each script has been given a title ( important, since they call each other ) and examples following.

The led_lab is six (6) LED(s) on a common cathode ground plane;  the anodes are driven (sourced) by the six (6) SD pins. I used low power ( 2-3 ma ) LED(s) in the following combinations with ballast resistors listed in ohms:

white-330, white-330, yellow-180, yellow-180, white-330, white-330

gpio160 - gpio165

( at this point i am not using the MCP23S17, nor the Padi Stamp )

Note:  see this link to get the information regarding modification of the dts|dtb ( very important ) !

Shy
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )


Messages In This Thread
uSD Breakout - by machinehum - 08-29-2017, 06:59 PM
RE: uSD Breakout - by MarkHaysHarris777 - 08-29-2017, 07:01 PM
RE: uSD Breakout - by machinehum - 08-29-2017, 08:09 PM
RE: uSD Breakout - by machinehum - 08-31-2017, 11:14 PM
RE: uSD Breakout - by machinehum - 09-05-2017, 08:04 PM
RE: uSD Breakout - by MarkHaysHarris777 - 09-05-2017, 09:16 PM
RE: uSD Breakout - by martinayotte - 09-06-2017, 07:59 AM
RE: uSD Breakout - by MarkHaysHarris777 - 09-06-2017, 08:52 AM
RE: uSD Breakout - by machinehum - 09-06-2017, 10:25 AM
RE: uSD Breakout - by dkryder - 09-06-2017, 04:56 PM
RE: uSD Breakout - by machinehum - 09-06-2017, 10:43 PM
RE: uSD Breakout - by machinehum - 09-08-2017, 07:45 PM
RE: uSD Breakout - by dkryder - 09-09-2017, 05:43 AM
RE: uSD Breakout - by martinayotte - 09-09-2017, 07:31 AM
RE: uSD Breakout - by MarkHaysHarris777 - 09-09-2017, 09:40 AM
RE: uSD Breakout - by machinehum - 09-09-2017, 06:45 PM
RE: uSD Breakout - by martinayotte - 09-10-2017, 07:38 AM
RE: uSD Breakout - by machinehum - 09-20-2017, 04:59 PM
RE: uSD Breakout - by dkryder - 09-21-2017, 01:37 AM
RE: uSD Breakout - by machinehum - 09-21-2017, 10:59 AM
RE: uSD Breakout - by martinayotte - 09-21-2017, 11:59 AM
RE: uSD Breakout - by dkryder - 09-24-2017, 12:51 AM
RE: uSD Breakout - by machinehum - 09-27-2017, 11:19 AM
RE: uSD Breakout - by machinehum - 09-27-2017, 05:58 PM
RE: uSD Breakout - by MarkHaysHarris777 - 10-06-2017, 09:29 PM
RE: uSD Breakout - by MarkHaysHarris777 - 10-07-2017, 12:13 AM
RE: uSD Breakout - by machinehum - 10-07-2017, 01:13 PM
RE: uSD Breakout - by MarkHaysHarris777 - 10-11-2017, 02:13 AM
RE: uSD Breakout - by machinehum - 10-11-2017, 10:49 AM
RE: uSD Breakout - by MarkHaysHarris777 - 10-13-2017, 06:19 AM
RE: uSD Breakout - by machinehum - 10-20-2017, 11:14 AM
RE: uSD Breakout - by tllim - 10-25-2017, 11:49 AM
RE: uSD Breakout - by dkryder - 11-10-2017, 07:47 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)