Skip to content

Instantly share code, notes, and snippets.

View sobuildit's full-sized avatar

So build it sobuildit

  • So build it
  • Southampton, UK
View GitHub Profile
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)
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)
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
# 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)
[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
@sobuildit
sobuildit / PWM_Controller.ino
Created December 15, 2021 14:00
Preliminary Controller Arduino code
// 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
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)