Copy and Paste  -   An Application to Copy/Paste Text  

 
S.No 4830 Name tuto Date/Time 08-May-2022 07:49:22 PM

Copy text from below

STEP 1: SETTING UP THE WEBCAM

 

 

Open up the terminal and run:

 

sudo su

 

Press Enter

 

This will change to admin console

 

Now write:

 

sudo apt-get update

 

 

 

After this finishes running, we should test that the webcam works. 

 

Plug your webcam into the Raspberry PI and run:

 

sudo apt-get install fswebcam 

 

(This will install the driver for the webcam)

 

fswebcam test.jpg

 

(This will take a picture from your webcam.

 

Open the file manager and see if there is a photo.)

 

 

STEP 2: INSTALLING AND CONFIGURING MOTION

 

 

In order to turn our webcam into a motion detector, we will be using the open-source "motion" library which 

was designed just for this purpose.

 

First, install motion by running:

 

sudo apt-get install motion

 

 

After the motion is installed, we need to install a file explorer using which we can edit the motion.conf file

 

For that purpose, give the following command:

 

sudo su

 

 

 

sudo apt-get install nautilus-admin

 

 

Now in terminal, write:

 

sudo su

 

nautilus

 

This will open a file manager window

 

 

Next,open the file manager and navigate to this path:

 

 

 

/etc/motion/motion.conf

 

perform the following changes:

 

on_event_start python /home/pi/switch_on_motor.py

 

on_event_end python /home/pi/switch_off_motor.py

 

event_gap 20

 

 

////////////////// CODE FOR switch_on_motor.py ////////////////

import time

import pygame

import sys

import RPi.GPIO as GPIO

RelayPin = 37   # pin11

 

 

def relayActivate(s):

    

    if s == "ON":

        print("Relay is ON")

        GPIO.setmode(GPIO.BOARD)

        GPIO.setup(RelayPin, GPIO.OUT)

        GPIO.output(RelayPin, GPIO.HIGH)

    else:

        print("Relay is OFF")

        GPIO.setmode(GPIO.BOARD)

        GPIO.setup(RelayPin, GPIO.OUT)

        GPIO.output(RelayPin, GPIO.LOW)

        GPIO.cleanup()

 

relayActivate("ON")

 

 

 

 

 

pygame.init() #<-- initializes video

pygame.mixer.init()

pygame.mixer.music.load("/home/pi/dog_bark_long.wav")

pygame.mixer.music.play()

 

 

SONG_END = pygame.USEREVENT + 0

pygame.mixer.music.set_endevent(SONG_END)

 

 

while True:

    for event in pygame.event.get():

        if event.type == SONG_END:

            print("the song ended!")

            pygame.mixer.music.stop()

            pygame.quit()

            sys.exit()

 

///////////////////////////////////////

 

 

 

////////////////// CODE FOR switch_off_motor.py ////////////////

 

import time

import pygame

import sys

import RPi.GPIO as GPIO

RelayPin = 37   # pin11

 

 

def relayActivate(s):

    

    if s == "ON":

        print("Relay is ON")

        GPIO.setmode(GPIO.BOARD)

        GPIO.setup(RelayPin, GPIO.OUT)

        GPIO.output(RelayPin, GPIO.HIGH)

    else:

        print("Relay is OFF")

        GPIO.setmode(GPIO.BOARD)

        GPIO.setup(RelayPin, GPIO.OUT)

        GPIO.output(RelayPin, GPIO.LOW)

        GPIO.cleanup()

 

relayActivate("OFF")

 

 

////////////////////////////////////////////

 

 

After we have changed the settings,Run:

 

sudo motion

 

To kill motion, we can use following commands:

 

sudo su

 

ps -aux | grep motion

 

kill <id of motion>

 

 

Download and install VLC by opening up a new terminal and running:

 

sudo apt-get install vlc

 

Once VLC is set up, we can watch the webcam stream by running:

 

vlc http://localhost:8081/stream.mjpg

 

(NOTE:This should not be run with root(sudo su)or it will show an error)

 





comments powered by Disqus
NEW ENTRIES
S.No Name Entry Time/Date
4867 test 1 23 Ev 26-Jul-2022 10:30:46 AM
4866 VideoHot 26-Jul-2022 08:03:07 AM
4865 test 12 26 M 25-Jul-2022 04:13:15 PM
4864 test 11 26 M 25-Jul-2022 04:12:10 PM
4863 test 8 26 M 25-Jul-2022 04:06:09 PM
4862 test 5 26 M 25-Jul-2022 04:04:24 PM
4861 test 4 26 M 25-Jul-2022 04:02:33 PM
4860 test 3 26 M 25-Jul-2022 03:46:17 PM
4859 code 25-Jul-2022 03:33:57 PM
4858 test 2 26 E 25-Jul-2022 03:01:32 PM
4857 test 1 26 M 25-Jul-2022 03:00:12 PM
4856 . 23-Jul-2022 09:16:04 PM
4855 UPDATED KID 23-Jul-2022 07:29:36 AM
4854 Beauty Lady 21-Jul-2022 08:43:09 AM
4853 UPDATED KID 20-Jul-2022 07:51:51 AM
4852 She is too 18-Jul-2022 11:05:25 AM
4851 HotVideos 15-Jul-2022 12:43:40 PM
4850 KIDDO VIDEOS 14-Jul-2022 08:47:38 AM
4849 UPDATE KIDDO 07-Jul-2022 07:34:23 AM
4848 Real SexyHot 05-Jul-2022 08:19:40 AM
4847 04-Jul-2022 07:07:30 PM
4846 UPDATE KIDDO 01-Jul-2022 11:15:43 AM
4845 PrettySexy 28-Jun-2022 01:18:54 PM
4844 26-Jun-2022 10:03:07 AM
4843 BEST NEW KID 25-Jun-2022 11:06:39 AM
4842 21-Jun-2022 07:05:47 PM
4841 S3xy Girls 08-Jun-2022 08:54:39 AM
4840 05-Jun-2022 08:20:05 AM
4839 31-May-2022 09:38:59 PM
4838 Tv 29-May-2022 10:43:08 PM

[First] [Prev] 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 [Next] [Last]
 
web counter
web counter


To report any error messages or bugs, or other issues, please send email at: info@pakproject.com