【飞凌RZ/G2L开发板试用体验】+04+LED闪烁

描述

本文来源电子发烧友社区,作者:先生, 帖子地址:https://bbs.elecfans.com/jishu_2301466_1_1.html


开发板体验视频,详见作者原文帖子

创建方法如下:
sudo -s
touch  grade.sh
vim grade.sh
#/bin/bash
#Verson:0.1
#Auther:diql
#Pragram:This pragram is calculation your grade
#import an argument
read -p "Please input your grade:" x
declare -i x
#jugemet $x value is none or not
IF [ "$x" == "" ];then
    echo "You don't input your grade...."
    exit 5
fi
#jugement the gread level
if [[ "$x" -ge "90" && "$x" -le "100" ]];then
    echo "Congratulation,Your grade is A."
elif [[ "$x" -ge "80" && "$x" -le "89" ]];then
    echo "Good,Your grade is B."
elif [[ "$x" -ge "70" && "$x" -le "79" ]];then
    echo "Ok.Your grade is C."
elif [[ "$x" -ge "60" && "$x" -le "69" ]];then
    echo "Yeah,Your grade is D."
elif [[ "$x" -lt "60" ]];then
    echo "Right,Your grade is F."
 
else
    echo "Unknow argument...."
 
fi
 
 
键入:
esc
:wq
 
chmod 700 grade.sh
./grade.sh
 
./build.sh all
 
 
/etc/update.sh
 
 
-----------------------------------------------------------
附带pwm071.sh
----------------------------------------------
#! /bin/sh
if [ $# != 2 ]; then
        echo "$0 <1/0>"
        echo "User:$0 P3_7 1"
        exit 0
fi
 
VAL=$1
N=${VAL##*_}
T=${VAL#*P}
M=${T%_*}
 
GPIOID=$((${M} * 8 + ${N}  + 120))
echo "==== GPIOID ${GPIOID} ======"
if [ ! -d /sys/class/gpio/gpio$GPIOID ]; then
        echo $GPIOID > /sys/class/gpio/export
        echo out > /sys/class/gpio/gpio${GPIOID}/direction
fi
 
echo "===$1===$2"
echo $2 > /sys/class/gpio/gpio${GPIOID}/value
 
 
for((i=1;i<=10;i+=1))
do
sleep 1
        echo $i
echo 1 > /sys/class/gpio/gpio${GPIOID}/value
sleep 1
echo 0 > /sys/class/gpio/gpio${GPIOID}/value
done

打开APP阅读更多精彩内容
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

全部0条评论

快来发表一下你的评论吧 !

×
20
完善资料,
赚取积分