C.H.I.P. Pro with shell script

Ring oscillator with shell script on C.H.I.P. pro.

This ring oscillator uses the sysfs interface to toggle the gpio pins. It's available here, or pasted below. I haven't looked into why it's so slow yet...


#stop listening in case we already were
echo 132 > /sys/class/gpio/unexport
echo 133 > /sys/class/gpio/unexport

# set pin 37 (D0) as input, sysfs = 132
echo 132 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio132/direction

# set pin 36 (D1) as output, sysfs = 133
echo 133 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio133/direction
echo 0 > /sys/class/gpio/gpio133/value

while(true)
do  
    echo $((1-$(cat /sys/class/gpio/gpio132/value))) > /sys/class/gpio/gpio133/value
done

Back