Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Maik Schmidt - Arduino A Quick-Start Guide, 2nd Edition (The Pragmatic Programmers) - 2015.pdf
Скачиваний:
146
Добавлен:
22.03.2016
Размер:
30.47 Mб
Скачать

What If It Doesn’t Work? 223

What If It Doesn’t Work?

If you cannot make this chapter’s code run, you should download the code from the book’s website and try to run it. Make sure you’re using the correct serial port in the code/RemoteControl/TvRemoteUI/js/remote.js file.

In this chapter, we mainly used LEDs and an Ethernet shield, so all of the advice from Chapter 3, Building Binary Dice, on page 39, and Chapter 10,

Networking with Arduino, on page 163, also applies to this chapter.

In addition, you have to be careful of more things. The distance between an infrared LED and its receiver is important. To be on the safe side, you should position the LED near the receiver. It should also be placed right in front of the receiver, and you should make sure there’s not too much ambient light that might disturb the infrared signal.

For debugging purposes, it’s useful to replace an invisible infrared LED with a regular LED from time to time. This way, you can see whether your circuit works in principle.

If you’re trying to control a Mac, you should unpair any other remote controls in the Security area of the Mac’s System Preferences window.

Finally, you might be using a device that uses a protocol that isn’t supported by the IRremote library. In this case, you have to add it. This can be tricky, but IRremote is open source, so at least it’s possible.

Exercises

Build an emulator for a remote control you find in your household. Make its commands available via serial port and via Ethernet.

Instead of controlling the Arduino via a serial monitor or web browser, control it using a Nintendo Nunchuk. You could move the analog stick up and down to control your TV set’s volume, and you could move it left or right to change the channel.

Design a real universal remote control based on an Arduino. Look for a touchscreen, a button pad, an SD card shield, and a Bluetooth module. I bet you didn’t think you could build a device like this—but you know everything you need to do it now.

report erratum • discuss

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]