Current version of the OpenAuto Pro is 11
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need Reverse cam setup Help
I am running a reverse cam from the OOP and I need the GPIO to trigger when it sees the circuit rising instead of falling or vice versa. Im assuming you have a python script that triggers when the gpio port you set has no load. I have setup my own reverse cam python script for when the gpio rises when triggered from an octocoupler, that is powered by my reverse lights. I want to use the reverse grid in OOP. can you point me to the script that runs the reverse cam so i can change it or give me a way to reverse the trigger?

here is what im running to give you a better idea,

my script is :
# Dim the screen and switch to the reverse camera.
# Remember, the switch or opto is switching to ground, so the logic is inverted... 0 = on  1 = off

import RPi.GPIO as GPIO
import time
import subprocess, os
import signal
RearView_Switch = 14  # pin 18  (You must use an optocoupler and resistor as shown in the video)
Brightness_Switch = 15 # pin 16  (You must use an optocoupler and resistor as shown in the video)
#Extra_Switch = 1  # pin 3
GPIO.setup(RearView_Switch,GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(Brightness_Switch,GPIO.IN, pull_up_down=GPIO.PUD_UP)

print "  Press Ctrl & C to Quit"

  run = 0
  bright = 0
  while True :
      time.sleep(0.25) #this restricts the script to check the lights every 1/4 second, There is no point in checking 10,000 times a second.
      # If the reverse reverse lights come on, do this:
      if GPIO.input(RearView_Switch)==0 and run == 0:
        print "Switching Rearview Camera On"
        rpistr = "raspivid -t 0 -vf -h 480 -w 800"
        p=subprocess.Popen(rpistr,shell=True, preexec_fn=os.setsid)
        run = 1
        # When the reverse lights go off, do this:
      if GPIO.input(RearView_Switch)==1 and run == 1:
        os.killpg(, signal.SIGTERM)
      print "Killing the reverse camera feed"
        run = 0
#These next Two blocks monitor the headlights or marker light and adjust the screen brightness settings.
      if GPIO.input(Brightness_Switch)==0 and bright == 0:
        print "Setting Brightness to 20" # 20 is about 10% ("/usr/local/bin/ 20", shell=True)
        bright = 1
      if GPIO.input(Brightness_Switch)==1 and bright == 1:
        print "Setting Brightness back to 255" #255 is 100% ("/usr/local/bin/ 255", shell=True)
        bright = 0

except KeyboardInterrupt:
  print "  Quit"

Forum Jump:

Users browsing this thread: 1 Guest(s)