Copyright © 2017 by McGraw-Hill Education. All rights reserved. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher. ISBN: 978-1-25-964480-1 MHID: 1-25-964480-4. The material in this eBook also appears in the print version of this title: ISBN: 978-1-25-964479-5, MHID: 1-25-964479-0. eBook conversion by codeMantra Version 1.0 All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps. McGraw-Hill Education eBooks are available at special quantity discounts to use as premiums and sales promotions or for use in corporate training programs. To contact a representative, please visit the Contact Us page at www.mhprofessional.com . Information has been obtained by McGraw-Hill Education from sources believed to be reliable. However, because of the possibility of human or mechanical error by our sources, McGraw-Hill Education, or others, McGraw- Hill Education does not guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from the use of such information. TERMS OF USE This is a copyrighted work and McGraw-Hill Education and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hill Education’s prior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms. THE WORK IS PROVIDED “AS IS.” McGRAW-HILL EDUCATION AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill Education and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill Education nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. McGraw-Hill Education has no responsibility for the content of any information accessed through the work. Under no circumstances shall McGraw-Hill Education and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or otherwise. CONTENTS Preface 1 Introduction to the Intel Galileo Hardware Summary Gen 1 and Gen 2 Comparison On-Board Linux Power Buttons Memory Input and Output Communication Programming Summary 2 Getting Connected Power the Board Communicating with Your Board Setting Up the Development Environment Setting Up the Galileo on Windows Setting Up the Galileo on OSX Setting Up the Galileo on Linux Hello World: Uploading Your First Code Summary 3 Arduino-Style C Programming What Is Programming? Setup and Loop Variables Floats Boolean Char Commands If Statement For Loops While Loops Arrays Strings Coding Best Practices Indentation Commenting Your Code Whitespaces Summary 4 Programming Outputs Experiment 1: Understanding Digital Outputs Experiment 2: Flashing an LED Experiment 3: LCD Experiment 4: Switching High-Voltage Appliances Using a Relay Experiment 5: Controlling a Servo Motor Summary 5 Inputs Digital Inputs Experiment 6: Reading a Switch digitalRead () Local and Global Variables Debouncing Analog Inputs Experiment 7: Reading a Potentiometer analogRead Const map() Variable Resistors Experiment 8: Voltage Divider Circuits Experiment 9: Reading Temperature Summary 6 Networking: Getting Connected Connecting to the Ethernet Dynamic and Static IP Address Connecting to Wi-Fi Setting Up the Wi-Fi Mini-PCIe Card Getting Started with Intel XDK IoT Edition Download and Install Intel XDK IoT Edition Download and Install Bonjour Print Services (Windows OS) Creating a New Project Summary 7 Internet-Connected Hardware Experiment 10: Analyzing Sensor Data on the Cloud Creating a Visual Dashboard Experiment 11: Creating a Simple Web Server Experiment 12: Creating a Web Server Using Express Experiment 13: Reading GPIO Pins on the Web Server Experiment 14: Controlling Digital Pins Using the Web Experiment 15: Home Automation Summary 8 Tools and Tips Breadboards and Prototyping Boards Multimeter Soldering Analog versus Digital Suppliers A Components and Hardware Resistors Switches Diodes Hardware and Miscellaneous Index About the Author Christopher Rush has a degree in computer science and has spent the last 10 years working for an electronics distribution company as a product manager for single-board computing. He is the author of 30 BeagleBone Black Projects for the Evil Genius ™ and Programming the Photon: Getting Started with the Internet of Things , both also published by McGraw-Hill Education. PREFACE This book is the perfect introduction to programming the Intel® Galileo development board. The Galileo was Intel’s first development board aimed for the maker market and based around their own Intel Quark SoC. With built-in Internet of Things capabilities, this board unleashes the powerful hardware expanding its capabilities to Internet-connected hardware. The Intel Galileo is fully compatible with the Arduino™-style programming language while also introducing its own libraries and features for connectivity. The board itself comes with the Arduino footprint for connecting Arduino- compatible hardware such as shields. On its own the board doesn’t really do much, but once you learn how to connect hardware it is fully capable of acting as the brain of your projects, controlling things and sending data to cloud services using the on-board Linux. This book presents you examples using the popular Grove system by Seeed- Studio, which allows you to interconnect hardware without the worries and frustration of dealing with circuits and soldering. Most of the examples use the parts commonly found in the Intel Galileo Grove Starter Kit. The purpose of this book is to get you started with creating your own hardware projects with the Intel Galileo. You do not need any previous experience with circuits or programming, but general computer skills would be highly advantageous. Programming the Intel ® Galileo is written to give you a wide variety of experience and a basic understanding of the capabilities of the Intel Galileo board. This book only covers the basics of how to program the board, the assumption being that you will then expand those skills to create your own exciting projects. I would love to hear your thoughts and comments regarding this book, so I encourage you to contact me through www.rushmakes.com or on Twitter @rushmakes. You can download all the example code from the McGraw-Hill website www.mhprofessional.com/intelgalileo or through my GitHub,
Description: