tailieunhanh - Smart Home Automation with Linux- Part 9
Smart Home Automation with Linux- P9:I will end on a note of carefree abandon—learn to steal! Once you’ve learned the pieces of the puzzle and how to combine them, there is very little new to invent. Every new idea you discover is a mere permutation of the old ideas. And ideas are free! Every cool feature discussed on TV shows or presented in the brochures or web sites of commercial HA companies can be taken, adapted, and implemented with the information presented here using very little effort | 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 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
đang nạp các trang xem trước