Welcome to Nick's Random Musings

Of course I don't know what I'm doing, what fun would that be?


Glow


meta
Nick Gully, Denver

Still shining. Baggage

Minecraft invisible frame post 1.20


meta
Nick Gully, Denver
/give @s item_frame[entity_data={id:"item_frame",Invisible:1b}]

Beautiful Bash Bits


meta
Nick Gully, Denver

With the bash shell, you can always recall and search the most recent commands with the command ‘history’. You can re-execute a previous command with Exclamation/Number, like ‘!42’ to run the forty second item.

movie bait


meta
Nick Gully, Denver
#film plexorama movie times in your area.
1.) Reboot	10:30	3:30	5:00
2.) Reboot	9:30	2:30	7:00
3.) Sequel	11:30	1:30	6:00
4.) Sequel	2:20	9:15	10:30
5.) Emmy bait		3:30	9:30 
6.) Reboot Sequel	12:00	2:00	6:00
7.) Podcast made script	6:00
8.) Sequel	1:30	2:30	7:30
9.) Car Ad	4:30	6:30	9:30
10.) Horror masking the inequities of our modern society	2:30 12:00a

Debian 11.6 bullseye on Raspberry Pi 3 with python3


meta
Nick Gully, Denver

I have a garage door I operate via a small raspberry pi with a solenoid wired to the normal garage door button. It mimics the action of pressing it. This is really nice for having access to operate the door even from my phone or smartwatch. Recently I realized it was running a very old version of Raspbian, and I wanted to update to a more up to date debian.

This makes for a interesting interaction between the nginx webserver, and getting a python script to access the GPIO ports of the pi. There are levels of security to traverse.

Python packages: gipod 2.2.20

Python script:

import gpiod
import cgi

form = cgi.FieldStorage()
action = form.getvalue('group')

print("Content-type: text/html\n\n")
print("Status: 200 OK\n\n")


with gpiod.Chip("/dev/gpiochip0") as chip:
     info = chip.get_info()
     print(f"{info.name} [{info.label}] ({info.num_lines} lines)")
import time

from gpiod.line import Direction, Value

LINE = 16

with gpiod.request_lines(
     "/dev/gpiochip0",
     consumer="blink-example",
     config={
         LINE: gpiod.LineSettings(
             direction=Direction.OUTPUT, output_value=Value.ACTIVE
         )
     },
) as request:
     request.set_value(LINE, Value.ACTIVE)
     time.sleep(1)
     request.set_value(LINE, Value.INACTIVE)
     time.sleep(1)

And you may have to make sure that other users (like www-data), can touch the /dev/gpiochip0 device.

sudo chmod a+rw /dev/gpiochip0
« Older Posts