2016-11-04

txt

this is a test thing


#!/bin/bash

echo "23" > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio23/direction

echo "Press button to continue"

switch=$(cat /sys/class/gpio/gpio23/value)
newswitch=$switch

#echo "$switch"

while [[ true ]]
do
    while [[ $switch != $(cat /sys/class/gpio/gpio23/value) ]]
    do
        newswitch=$(cat /sys/class/gpio/gpio23/value)
        # echo "changed"
        break
    done
    # echo "same"
    if [ "$switch" != "$newswitch" ]
    then
        switch=$(cat /sys/class/gpio/gpio23/value)
        newswitch=$switch
        break
    fi
done

echo "clicked"
echo "Input is: $(cat /sys/class/gpio/gpio23/value)"
sleep 0.5

switch=$(cat /sys/class/gpio/gpio23/value)
newswitch=$switch

echo "Press button to continue"
while [[ true ]]
do
    while [[ $switch != $(cat /sys/class/gpio/gpio23/value) ]]
    do
        newswitch=$(cat /sys/class/gpio/gpio23/value)
        # echo "changed"
        break
    done
    # echo "same"
    if [ "$switch" != "$newswitch" ]
    then
        break
    fi
done

#Loop waiting for click ...
while [[ true ]]; do
    #statements

    switch=$(cat /sys/class/gpio/gpio23/value)
    newswitch=$switch

    echo "In a loop"
    echo "Press button to continue"
    while [[ true ]]
    do
        while [[ $switch != $(cat /sys/class/gpio/gpio23/value) ]]
        do
            newswitch=$(cat /sys/class/gpio/gpio23/value)
            # echo "changed"
            break
        done
        # echo "same"
        if [ "$switch" != "$newswitch" ]
        then
            break
        fi
    done

done

echo "23" > /sys/class/gpio/unexport


more text here...

No comments:

Post a Comment