#!/bin/bash #gpio33: AUX IN DET #gpio63: AMP EN #gpio78: DSP DET #gpio79: AMP SD #gpio80: AUDIO MUTE #gpio81: DSP RST #gpio108:Audio SW SEL1 #gpio109:Audio SW SEL2 #gpio118:WPS/RESET #gpio120:Trigger word (blue genie) #gpio124:LED_SDB gpio_n=(33 63 78 79 80 81 108 109 118 120 124) #number gpio_d=(in out in out out out out in in in out) #direction gpio_v=(0 1 0 0 0 1 1 0 0 0 0) #value for ((i=0; i<${#gpio_n[@]}; i++)); do if [ -d "/sys/class/gpio/gpio${gpio_n[i]}" ]; then echo "The gpio${gpio_n[i]} already exists" else sudo echo ${gpio_n[i]} > /sys/class/gpio/export sudo echo ${gpio_d[i]} > /sys/class/gpio/gpio${gpio_n[i]}/direction sudo echo ${gpio_v[i]} > /sys/class/gpio/gpio${gpio_n[i]}/value fi done
2018年8月16日 星期四
Initializing GPIO
標籤:
Linux Script
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言