• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 3. Remotely Monitor a Pet > Understanding the Script

3.4. Understanding the Script

Unlike in some of the other projects, the script in this project will work for most people without any modification. However, you could extend it a great deal if you wanted to, so I'll describe what the different sections of code do and what the variables are. There's a lot of code in this script, but the most interesting lines appear within the infinitely running while loop and the subroutines. Everything before the while loop initializes variables, modules, and the serial port. This section of code contains variables that you may wish to modify if you have used different house or unit codes:

	my $motion_hc = "C";
	my @motion_ucs = ("2", "3", "4");
	my $album_path = '/var/www/cgi-bin/ids/albums';
	my $webcam_config = '/etc/petcam.config';
	my $serial_port = Device::SerialPort->new("/dev/ttyS0",1);

	my $min_bright = 0.07; # Minimum brightness acceptable
	my $min_color = 0.15;		# Minimum brightness before forcing B&W
	my $min_raw = 0.25;		# Minimum brightness to not equalize
	my $apix = 200;			# Number of pixels to analyze (squared)
	my $crop = 10;			# Number of pixels to crop off each side


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint