Chapter 17

Make a Simple Webcam

In Chapter 16, you can make a simple camera. How about putting the photo it takes onto a web page to make a webcam? You can leave the cam in your room to check on pets, brothers, sisters, or other aliens.

image

Set Up a Webpage

If you read Chapter 15, you know that you can put the Python script inside a PHP script and it should work. Right?

Try it. You can use the PHP file from Chapter 15 or make a new one in the /usr/share/nginx/www directory. Make sure that it’s called index.php.

Instead of using Leaf on the desktop, you can edit the file in a more Linux-y kind of a way.

Meet nano

In Chapter 15, you can find out how use the touch and chmod commands to make a new file and then make it editable in the Leaf desktop editor.

There’s a better way!

Linux includes an editor that works from the command line. It’s called nano. You can use it with sudo to edit any file or make a new file as root.

Compared to a desktop text editor, nano can feel strange and even clumsy. But once you get used to it, it’s quicker.

Because nano works from the command line, you can’t use it with a mouse. Instead, you have to type commands. All the commands work the same way: You hold down the Control key, and you type a letter.

warning You don’t press Enter when you’re using nano commands. ...

Get Raspberry Pi For Kids For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.