update
This commit is contained in:
parent
fbcea1b018
commit
6541e34ab5
|
@ -0,0 +1,18 @@
|
|||
'''
|
||||
实验名称:熄灭第1个LED
|
||||
实验平台:核桃派
|
||||
'''
|
||||
|
||||
# 导入相关模块
|
||||
import board
|
||||
from digitalio import DigitalInOut, Direction
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
try:
|
||||
# 构建LED对象和初始化
|
||||
led = DigitalInOut(board.LED) # 定义引脚编号
|
||||
led.direction = Direction.OUTPUT # IO为输出
|
||||
led.value = 0 # 输出低电平,熄灭板载LED蓝灯
|
||||
except Exception as e:
|
||||
pass
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
sudo crontab -l > cron.cron
|
||||
echo "*/1 * * * * /usr/bin/bash /home/pi/lot_manager/conf/example/bash/start_dataupload_internal_one_hour.sh" >> cron.cron
|
||||
sudo crontab cron.cron
|
||||
sudo systemctl restart cron.service
|
||||
sudo rm -rf cron.cron
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
supervisorctl restart data_upload
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
supervisorctl stop data_upload
|
|
@ -0,0 +1,2 @@
|
|||
# 每隔一分钟执行一次任务
|
||||
*/1 * * * * /usr/bin/bash /home/pi/lot_manager/conf/example/bash/start_dataupload_internal_one_hour.sh
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
sudo crontab -l > cron.cron
|
||||
echo "0 9 * * * sudo /usr/bin/python /home/pi/lot_manager/open_led.py" >> cron.cron
|
||||
echo "0 17 * * * sudo /usr/bin/python /home/pi/lot_manager/close_led.py" >> cron.cron
|
||||
sudo crontab cron.cron
|
||||
sudo systemctl restart cron.service
|
||||
sudo rm -rf cron.cron
|
|
@ -0,0 +1,18 @@
|
|||
'''
|
||||
实验名称:熄灭第1个LED
|
||||
实验平台:核桃派
|
||||
'''
|
||||
|
||||
# 导入相关模块
|
||||
import board
|
||||
from digitalio import DigitalInOut, Direction
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
try:
|
||||
# 构建LED对象和初始化
|
||||
led = DigitalInOut(board.LED) # 定义引脚编号
|
||||
led.direction = Direction.OUTPUT # IO为输出
|
||||
led.value = 1 # 输出高电平,点亮板载LED蓝灯
|
||||
except Exception as e:
|
||||
pass
|
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
import serial
|
||||
|
@ -190,6 +191,9 @@ def local():
|
|||
}
|
||||
t = LOT_DATA(**data)
|
||||
add(t)
|
||||
subprocess.Popen(
|
||||
["/usr/bin/bash /home/pi/lot_manager/conf/example/bash/stop_dataupload_internal_one_hour.sh"],
|
||||
shell=True)
|
||||
except Exception as e:
|
||||
# print(e)
|
||||
pass
|
||||
|
|
|
@ -195,6 +195,9 @@ def get_data():
|
|||
t2 = LOT_DATA(**data)
|
||||
client.publish(publish_topic, payload=json.dumps(data, ensure_ascii=False), qos=0)
|
||||
add(t2)
|
||||
subprocess.Popen(
|
||||
["/usr/bin/bash /home/pi/lot_manager/conf/example/bash/stop_dataupload_internal_one_hour.sh"],
|
||||
shell=True)
|
||||
except Exception as e:
|
||||
# print(e)
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue