WOW! eBook www.wowebook.org For online information and ordering of this and other Manning books, please visit Topwicws w.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact Tutorials Special Sales Department Offers & Deals Manning Publications Co. 20 Baldwin Road PO Box 761 Highlights Shelter Island, NY 11964 Email: [email protected] Settings ©2018 by Manning Publications Co. All rights reserved. Support No part of this publication may be reproduced, stored in a retrieval system, or Sign Out transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acidfree paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine. WOW! eBook www.wowebook.org Developmental editor: Susanna Kline Review editor: Ivan Martinovic Project editor: Kevin Sullivan Copyeditor: Andy Carroll Proofreader: Melody Dolab Typesetter: Gordan Salinovic Cover designer: Leslie Haimes Cover and interior illustrations: Lyza Danger Gardner ISBN 9781617293863 Printed in the United States of America 1 2 3 4 5 6 7 8 9 10 – EBM – 23 22 21 20 19 18 WOW! eBook www.wowebook.org Playlists Brief Table of Contents History Copyright Topics Brief Table of Contents Tutorials Table of Contents Offers & Deals Preface Highlights Acknowledgments Settings About this Book Support 1. A JavaScripter’s introduction to hardware Sign Out Chapter 1. Bringing JavaScript and hardware together Chapter 2. Embarking on hardware with Arduino Chapter 3. How to build circuits 2. Project basics: input and output with JohnnyFive Chapter 4. Sensors and input Chapter 5. Output: making things happen Chapter 6. Output: making things move 3. More sophisticated projects Chapter 7. Serial communication Chapter 9. Building your own thing WOW! eBook www.wowebook.org 4. Using JavaScript with hardware in other environments Chapter 10. JavaScript and constrained hardware Chapter 11. Building with Node.js and tiny computers Chapter 12. In the cloud, in the browser, and beyond Index List of Figures List of Tables List of Listings WOW! eBook www.wowebook.org Playlists Table of Contents History Copyright Topics Brief Table of Contents utorials Table of Contents ffers & Deals Preface ghlights Acknowledgments ettings About this Book Support 1. A JavaScripter’s introduction to hardware Sign Out Chapter 1. Bringing JavaScript and hardware together 1.1. The anatomy of hardware projects 1.1.1. Inputs and outputs 1.1.2. Processing 1.1.3. Power, circuits, and systems 1.1.4. Logic and firmware 1.1.5. Enclosures and packaging 1.1.6. Embedded systems 1.2. How JavaScript and hardware work together 1.2.2. Embedded JavaScript WOW! eBook www.wowebook.org 1.2.3. Other hardwareJavaScript combinations 1.3. Is JavaScript a good fit for hardware? 1.4. Putting together a hardware toolkit 1.4.1. Development boards 1.4.2. Input and output components 1.4.3. Other electronic components 1.4.4. Power, wires, and accessories 1.4.5. Tools Summary Chapter 2. Embarking on hardware with Arduino 2.1. Getting to know the Arduino Uno 2.1.1. Creating your first circuit with an Arduino Uno 2.2. Working with the Arduino workflow 2.2.1. Arduino Uno’s digital pins 2.2.2. Sketches and the Arduino IDE 2.2.3. Connecting the LED to a digital pin 2.2.4. Programming the LED to blink 2.3. Controlling the Arduino with JavaScript 2.3.1. Configuring the Arduino as a client 2.3.2. Installing the JohnnyFive Node.js framework 2.3.3. Hello World blinking LED with JohnnyFive 2.3.4. Firmata, JohnnyFive, and the hostclient method WOW! eBook www.wowebook.org 2.3.5. Structuring scripts with JohnnyFive Summary Chapter 3. How to build circuits 3.1. Voltage, current, and resistance 3.1.1. Ohm’s law 3.1.2. Problems and dangers 3.2. Building circuits 3.2.1. Using breadboards to prototype circuits 3.2.2. Wiring a simple LED circuit on a breadboard 3.2.3. Expanding a series circuit with a button 3.2.4. LEDs in series 3.2.5. Parallel circuits and current dividers 3.2.6. Powering your project with batteries Summary 2. Project basics: input and output with JohnnyFive Chapter 4. Sensors and input 4.1. Working with analog sensors 4.1.1. Analogtodigital conversion 4.1.2. Working with photoresistors 4.1.3. Voltage dividers 4.1.4. Wiring and using a photoresistor 4.1.5. Using an analog temperature sensor WOW! eBook www.wowebook.org 4.2. Digital inputs 4.2.1. Using a button as a digital input Summary Chapter 5. Output: making things happen 5.1. Lighting things up 5.1.1. Fading LEDs with pulsewidth modulation (PWM) 5.1.2. Animating LEDs with PWM 5.1.3. Combining input with LED output 5.1.4. Going fullcolor with RGB LEDs 5.1.5. Build your own “weather ball” 5.2. Working with parallel LCD displays 5.2.1. Making a fullfeatured timer with LCD 5.2.2. Adding a visual LED “chime” 5.3. Making noise with a piezo 5.3.1. Adding an audible piezo chime to the timer Summary Chapter 6. Output: making things move 6.1. Making motors spin 6.1.1. How motors work 6.1.2. Controlling a motor with a pushbutton switch 6.1.3. Controlling a motor with JohnnyFive 6.2. Making servos go WOW! eBook www.wowebook.org 6.2.1. Controlling a servo with JohnnyFive 6.3. Building your first robot! 6.3.1. Robots and motors 6.3.2. Building the robot’s chassis base 6.3.3. Controlling the robot’s motors Summary 3. More sophisticated projects Chapter 7. Serial communication 7.1. Communicating digital data in parallel and in serial 7.2. The basics of serial communication 7.3. Asynchronous serial communication 7.3.1. UARTs 7.3.2. Trying out software serial with a GPS breakout board 7.3.3. Learn to solder! 7.3.4. Building the GPS circuit 7.4. Synchronous serial communication 7.4.1. Serial Peripheral Interface (SPI) 7.4.2. I2C 7.4.3. Making a digital compass with an I2C magnetometer 7.5. Pulling it together: shaketochange multisensor widget 7.5.1. Step 1: combining a compass with LCD output 7.5.2. Step 2: adding a multisensor to the device WOW! eBook www.wowebook.org
Description: