yep, I know C++ & C# language but this kind of program is beyond my skills,I'm looking for a hardware switch.If there is a way to switch between them with software I'll be glad to do that.ghans wrote:Since your application becomes nearly impossible without
an OS , you will have to use OS features to implement the
"camera switch" button ...
Do you know any programming language ?
Code: Select all
import pygame, sys from pygame.locals import * import pygame.camera import time pygame.camera.init() pygame.init() windowSurfaceObj = pygame.display.set_mode((640,480),1,16) camera = 0 cam = pygame.camera.Camera("/dev/video" +str(camera),(640,480)) cam.start() auto = "ON" switchtime = 5 maxcam = 3 x = 0 while x == 0: timer = 0 start = time.time() while timer < switchtime: if auto == "ON": timer = time.time()-start windowSurfaceObj.blit(cam.get_image(),(0,0)) color = pygame.Color(255,0,255) fontObj = pygame.font.Font('freesansbold.ttf',16) msgSurfaceObj = fontObj.render("Camera: " + str(camera+1)+ " Auto: " + auto, False,color) msgRectobj = msgSurfaceObj.get_rect() msgRectobj.topleft =(0,0) windowSurfaceObj.blit(msgSurfaceObj, msgRectobj) pygame.display.update() for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() elif event.type == KEYDOWN: kz = event.key cam.stop() if kz == K_1: camera = 0 if kz == K_2: camera = 1 if kz == K_3: camera = 2 cam = pygame.camera.Camera("/dev/video" + str(camera),(640,480)) cam.start() if kz == K_a: if auto == "ON": auto = "OFF" else: auto = "ON" cam.stop() camera = camera + 1 if camera == maxcam: camera = 0 cam = pygame.camera.Camera("/dev/video" +str(camera),(640,480)) cam.start()
GATE is shown as 0 to 4.9v on the scope trace on the linked page. It is the output of a lmv324 OPAMP via a 100 Ohm resistor so level shifting should be used - a voltage divider would do.gordon77 wrote:Is there a single source of the 'sound' or are you expecting it to switch to a camera where it hears a sound ?
Take a look at something like this...
https://learn.sparkfun.com/tutorials/so ... okup-guide
but you may need to add an interface with the Pi as its not clear what the output GATE voltage is.