This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
# GPIO setup for front panel button | |
panelButton = 14 | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(panelButton, GPIO.IN, pull_up_down=GPIO.PUD_UP) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from board import SCL, SDA | |
import busio | |
from PIL import Image, ImageDraw | |
import adafruit_ssd1306 | |
# Create the I2C interface. | |
i2c = busio.I2C(SCL, SDA) | |
disp = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psutil | |
from vcgencmd import Vcgencmd | |
vcgm = Vcgencmd() | |
# Network stuff from psutil | |
net_if_addrs = psutil.net_if_addrs()['eth0'][0] | |
IP = net_if_addrs.address | |
netmask = net_if_addrs.netmask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# one-time information grabs | |
cmd = "dpkg -l | awk '/openmediavault /{ print $3;} '" | |
omvpkg = subprocess.check_output(cmd, shell=True).decode("utf-8") | |
print("OMV Version: ", omvpkg) | |
# date / time | |
cmd = "date +\"%H:%M %d/%m/%Y\"" | |
date = subprocess.check_output(cmd, shell=True).decode("utf-8") | |
print("Date: ", date) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=DaveNAS front panel service | |
After=multi-user.target | |
[Service] | |
Type=idle | |
ExecStart=/usr/bin/python3 /home/pi/display_stat.py | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Digital setup | |
#define CH0 3 | |
#define CH1 5 | |
#define CH2 6 | |
#define CH3 9 | |
#define CH4 10 | |
#define CH5 11 | |
#define PWM_IDLE 128 | |
#define PWM_MAX 255 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial,time | |
pwm=64 | |
ser = serial.Serial('COM3', baudrate=57600, timeout=None) # open serial port | |
print(ser.name) # check which port was really used | |
while 1: | |
ser.write(b"S 0:72,1:72,2:72,3:72,4:72,5:72\n") # write a string | |
time.sleep(0.5) |