Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- root@wyswietlacz(ro):/mnt/ramdisk# more /home/pi/wyswietlacz/automatyka.py
- import os
- from time import *
- from subprocess import call
- timer = 0
- call("sudo /usr/bin/rdate -s ntp.task.gda.pl", shell=True)
- while True:
- sleep(5)
- timer = timer + 1
- #wykonanie sekwencji komend i pobranie potrzebnych zmiennych
- if timer == 1:
- call("/usr/bin/python /home/pi/wyswietlacz/bme280_temperature.py", shell = Tru
- e)
- timer = timer + 1
- if timer == 2:
- call("/usr/bin/python /home/pi/wyswietlacz/esp_hubert.py", shell = True)
- timer = timer + 1
- if timer == 3:
- call("/usr/bin/python /home/pi/wyswietlacz/esp_zew.py", shell = True)
- timer = timer + 1
- if timer == 4:
- call("/bin/cat /sys/class/thermal/thermal_zone0/temp > /mnt/ramdisk/temp_cpu",
- shell = True)
- timer = timer + 1
- if timer == 5:
- call("/usr/bin/free | grep Mem | awk '{print $4/$2 * 100.0}' > /mnt/ramdisk/ra
- m_free", shell = True)
- timer = timer + 1
- if timer == 6:
- call("/bin/df -h |grep root > /mnt/ramdisk/sd_card", shell = True)
- timer = timer + 1
- if timer == 7:
- call("x=$(cat /proc/uptime|awk '{print $1}') ; echo $x > /mnt/ramdisk/uptime",
- shell = True)
- timer = timer + 1
- if timer == 8:
- call("/bin/cpu_utilization > /mnt/ramdisk/cpu_usage", shell = True)
- print(timer)
- timer = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement