Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Apress - Smart Home Automation with Linux (2010)- P17: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 apt-get install gcc-avr avr-libc avrdude Java if uninstalled will need an extra line like this apt-get install openjdk-6-jre From here it s a simple matter of installing the IDE. This is provided as a single archive from the web site at http arduino.cc en Main Software. Extract this to an appropriate directory root access is not required for any of these steps and run . arduino from the directory. You should then set up the appropriate USB device and type of Arduino Tools Serial Port and Tools Board respectively before use. You can begin a project by selecting File New from the menu. This creates what the Arduino IDE calls a sketch. This involves a subdirectory in the Arduino working folder and a primary source file. Other source files can be added into the sketch through Sketch Add File and will be automatically included into the project build. There is no Makefile equivalent here and every file added to the sketch even if it is a library file from another directory is copied into the sketch directory. Note that despite the visual similarity to C code all files are given the extension .pde for clarity. Then verify the build and if everything is working 9 upload it to the Arduino. Note You cannot create a sketch of a given name. Instead you must create a blank new sketch and then select Save As as a separate step. The build process itself is handled behind the scenes using avr-gcc a cross-compilation toolchain for the Atmel AVR RISC processors of which the ATmega168 is one. It creates a separate applet directory inside the sketch folder and copies all the header files into it along with a concatenation of all the source files ending in .pde . It is this .cpp source file that is then cross-compiled into hex for upload to the Arduino. Arduino Software The simplest circuit that most people build to test their setup is that of a flashing light. Pin 13 on the Arduino Diecimila board has a built-in resistor allowing you to directly connect an