TAILIEUCHUNG - Apress - Smart Home Automation with Linux (2010)- P20

Apress - Smart Home Automation with Linux (2010)- P21:Linux users can now control their homes remotely! Are you a Linux user who has ever wanted to turn on the lights in your house, or open and close the curtains, while away on holiday? Want to be able to play the same music in every room, controlled from your laptop or mobile phone? Do you want to do these things without an expensive off-the-shelf kit | CHAPTER 2 APPLIANCE HACKING This might be to record the sound with vox_record. sh bin bash LOGFILE var log voxrecordpid DIR_INCOMING usr local media voxrecord if 1 start then FILENAME mktemp -p DIR_INCOMING .wav arecord -f cd -t wav FILENAME dev null dev null 2 1 PID echo PID LOGFILE fi if 1 stop then PID cat LOGFILE kill PID rm LOGFILE fi or play back each sound in the directory with bin bash DIR_INCOMING usr local media voxrecord for F in DIR_INCOMING .wav do play F done or even delete them all through bin bash DIR_INCOMING usr local media voxrecord rm -f DIR_INCOMING Naturally there is a lot more scope here to support the deletion of individual recordings and so on. But this represents the idea. Note The Minerva system abstracts these ideas out into Minx which eliminates the need for separate executables for each Arduino application. Minerva will be covered in Chapter 7. 78 CHAPTER 2 APPLIANCE HACKING Joysticks for Input Joysticks particularly old ones make wonderful input devices because they interface with the parallel port on most standard sound cards and are physical rugged. This enables the buttons to be reused particularly as foot pedals to control software. Indeed this provides a very cheap way of adding a dictation module to your machine without the need for an Arduino providing the input. In addition to triggering individual events on a Linux machine such as requesting a weather report or the state of the machine it can also feed messages to other applications. mplayer for example can operate in slave mode allowing commands to be fed to it from the standard input or a named pipe. Similarly the X Window TV-viewing software xawtv comes with xawtv-remote to change channel and volume as per most remote controls giving you capture on off and screenshot facilities. This makes it possible to freeze frame magic shows to see how they do it You can read the joystick directly from dev js0 but it is usually better to use an abstraction .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.