IO pins are little pins on the side of a Raspberry Pi, allowing you to send signals to other devices. they are quite easy to work with in the raspberry pi using a python script,
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(fan_pin, GPIO.OUT)
GPIO.setup(smoke_pin, GPIO.OUT)the above code can be used to set up gpio pins, and then you can use something like:
is_on = true
GPIO.output(fan_pin, is_on)to turn them on.
See a more comprehensive section of code underneath, started by me and extended by Jakob.
import time
import RPi.GPIO as GPIO
# import vlc
fan_pin = 24
smoke_pin = 23
fan_on = False
smoke_on = False
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(fan_pin, GPIO.OUT)
GPIO.setup(smoke_pin, GPIO.OUT)
state = False
# ...
if fan_now_on is not fan_on:
fan_on = fan_now_on
GPIO.output(fan_pin, fan_now_on)
print(seconds, f"{fan_now_on=}")
if smoke_now_on is not smoke_on:
smoke_on = smoke_now_on
GPIO.output(smoke_pin, smoke_now_on)
print(seconds, f"{smoke_now_on=}")