Help with GPIO trigger - Raspberry Pi Forums


hi all,

first new boards , new messing around raspberry pi, running mine digital taplist beer fridge using raspberry pints, have added pir motion sensor wake screen when motion detected. working great wanted integrate additional function trigger ssr turn on fridge lights when same motion detected, have ssr wired gpio24 (pin18 & pin20 ground) , having hard time manipulating code ssr switch when motion dectected.

, appreciated, below current code running screen wake.

code: select all

#!/usr/bin/env python  import os import rpi.gpio gpio import time  cmd = 'xscreensaver-command -deactivate'  gpio.setmode(gpio.bcm) pir_pin=7 gpio.setup(pir_pin, gpio.in)  def motion(pir_pin): 	os.system(cmd) 	time.sleep(1)  time.sleep(2)  try: 	gpio.add_event_detect(pir_pin, gpio.rising, callback=motion) 	while 1: 		time.sleep(100)  except keyboardinterrupt: 	gpio.cleanup() 
pic of beer fridge.
image

what have tried , and how didn't work? might try along lines of:

code: select all

gpio.setmode(gpio.bcm) pir_pin = 7 ssr_pin = 18 gpio.setup(pir_pin, gpio.in) gpio.setup(ssr_pin, gpio.out)  def motion(pir_pin):    os.system(cmd)    gpio.output(ssr_pin, 1)    time.sleep(1)    gpio.output(ssr_pin, 0)


raspberrypi



Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support