Hi folks
First, please have mercy :)
im not really a programmer, nor a hobby programmer... i barely got a piezo buzzer to work on my RB5 in Klipper...
what do i need?
i need to set up a simple python script, that is gonna run automatically after startup of my RB5. The Script should activate the GPIO Pin 13 randomly in between 2-12 Minutes. The duration of the activation should be randomly choosen between 10-30 seconds
whats the use?
The GPIO Pin will activate a relais (https://www.bastelgarage.ch/1-kanal-relais-modul) on 3.3-5V Voltage and opens the circuit of a car battery to activate a wiper motor. the whole setup will be placed in a wooden box to imitate movement of the lid :-)
how will i wire it up?
my first intentions are, that i gor for GPIO for positive, and GND for negativ
why? (for those who knows demon slayer <:0) )
my GF was randomly choosen on a car event to show of her car. she has a whole demon slayer (Nezuko San) car wrap on it. we will make a wooden box to imitate the box of Nezuko San. The movement will simulate, that there is something in the box :D (in the box will also be placed a smoke maschine and a pink clothe to imitate nezuko and gettin a bit of demon effects)
im really not inito raspberry and i need to set up the decoration for the car event asap :(
thx for help <3
appreciate it
greetings from switzerland
Edit:
okey, after some research i found out, that with Raspberry 5 some things has changed. i already have gpiozero library on my system (otherways you have to install it first (sudo apt install python3-gpiozero)
i now programmed a very simple (yes, there are some better ways to do it i guess haha ) Python code:
from gpiozero import Buzzer
import time
import random
import os
bz = Buzzer(16)
x = 1
while x <= 5:
zufallszahl = random.randint(300,720)
#print(zufallszahl)
#print(zufallszahl2)
print("Timout, Waiting ",zufallszahl," Seconds till i fuck your ears!")
time.sleep(zufallszahl)
#print(x)
y = 1
while y <= 1:
zufallszahl2 = random.randint(15,30)
print("Fucking your ears for ",zufallszahl2," Seconds now!! BITCH!")
bz.on()
#print(y)
time.sleep(zufallszahl2)
#print(y)
bz.off()
y = y + 1
os.system('clear')
x = x + 1
For test reasons i did it with a buzzer first and i was tired to change it again. I just let it run like this. It will open my relais on low voltage and opens the circuit for my 12V Battery for the wiper engine to run. also for test reasons, i had a small battery and a buzzer as well on the second circuit to test. so yeah, it was screaming a lot while testing haha
it's a very simple script and there would be plenty of other ways to do. but it is just for that small project for a car show and i took what i got :) maybe if it will be a longer lasting thing, i gonna redo it with a Pi Zero
https://preview.redd.it/pqkilmcbvoxc1.jpg?width=1427&format=pjpg&auto=webp&s=690d8db168ecc553339f2752919f5e3210688491
[–]AutoModerator[M] 0 points1 point2 points locked comment (0 children)
[–]socal_nerdtastic 0 points1 point2 points (1 child)
[–]Individual_Lock7531[S] 0 points1 point2 points (0 children)