飞腾派
直播中

卢松涛

12年用户 469经验值
擅长:嵌入式技术
私信 关注
[经验]

【飞腾派4G版免费试用】2飞腾派 openkylin 时间2

接上文【飞腾派4G版免费试用】2飞腾派 openkylin 时间
进行IO控制其实不需要上显示和openkylin这么大的系统, 实时性也不十分好。起动后时间为
root@openkylin:~# date2023年 08月 25日 星期五 14:05:50 CST

rc.local文件

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

#sudo /usr/sbin/ntpdate   203.107.6.88
/root/start.sh

start.sh文件

#!/bin/sh

LEDr_GPIO=/sys/class/gpio/gpio449
LEDg_GPIO=/sys/class/gpio/gpio492
LEDy_GPIO=/sys/class/gpio/gpio491
sudo /usr/sbin/ntpdate   203.107.6.88
if test -d $LEDr_GPIO; then

    echo "GPIO449 already exported"

else

    echo 449 > /sys/class/gpio/export

fi
if test -d $LEDg_GPIO; then

    echo "GPIO492 already exported"

else

    echo 492 > /sys/class/gpio/export

fi
if test -d $LEDy_GPIO; then

    echo "GPIO491 already exported"

else

    echo 491 > /sys/class/gpio/export

fi
echo out > $LEDr_GPIO/direction
echo out > $LEDg_GPIO/direction
echo out > $LEDy_GPIO/direction
while true; do

    echo 0 > $LEDr_GPIO/value
    echo 0 > $LEDg_GPIO/value
    echo 0 > $LEDy_GPIO/value 
    echo 1 > $LEDr_GPIO/value       
    sleep 5
    echo 0 > $LEDr_GPIO/value
    echo 1 > $LEDg_GPIO/value
    sleep 5
    echo 0 > $LEDg_GPIO/value
    echo 1 > $LEDy_GPIO/value         
    sleep 0.5
    echo 0 > $LEDy_GPIO/value         
    sleep 0.5    
    echo 1 > $LEDy_GPIO/value         
    sleep 0.5
    filename="`date +%y`"
    if test $filename = "23"
    then
      echo 'yes两个字符串相等!'
      sudo /usr/sbin/ntpdate   203.107.6.88
    else
      echo 'no两个字符串不相等!'
    fi
done

1706617259803.png

com:

[  OK  ] Started Disk Manager.
[  OK  ] Started Network Manager.
[  OK  ] Reached target Network.
         Starting /etc/rc.local Compatibility...
[   46.693462] rc.local[711]: 25 Aug 14:03:43 ntpdate[711]: no servers can be used, exiting
         Starting OpenBSD Secure Shell server...
         Starting Permit User Sessions...
[  OK  ] Started "Embedded taskset big core server".
[   47.054771] rc.local[731]: 25 Aug 14:03:44 ntpdate[731]: no servers can be used, exiting
[   58.590787] rc.local[713]: yes▒▒▒▒ַ▒▒▒▒!
[   64.748290] rc.local[890]: 30 Jan 20:07:32 ntpdate[890]: step time server 203.107.6.88 offset 13673010.219202 sec
[   76.271209] rc.local[713]: no▒▒▒▒ַ▒▒▒▒!
[   87.785410] rc.local[713]: no▒▒▒▒ַ▒▒▒▒!

更多回帖

发帖
×
20
完善资料,
赚取积分