Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning JavaScript Robotics

You're reading from  Learning JavaScript Robotics

Product type Book
Published in Nov 2015
Publisher
ISBN-13 9781785883347
Pages 160 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Kassandra Perch Kassandra Perch
Profile icon Kassandra Perch

Table of Contents (16) Chapters

Learning JavaScript Robotics
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Getting Started with JS Robotics Working with Johnny-Five Using Digital and PWM Output Pins Using Specialized Output Devices Using Input Devices and Sensors Moving Your Bot Advanced Movement with the Animation Library Advanced Components – SPI, I2C, and Other Devices Connecting NodeBots to the World, and Where to Go Next Index

Preface

Hello! Welcome to Learning JavaScript Robotics. In this book, you'll learn how to write code for Arduino and other robotics platforms in JavaScript using Johnny-Five. We'll cover the basics of Johnny-Five, input and output devices, and even movement devices such as servos and motors. Finally, we'll cover how to connect your bots to the Internet and move your Johnny-Five code between different platforms.

What this book covers

Chapter 1, Getting Started with JS Robotics, will get you started by setting up an Arduino Uno and exploring the world of NodeBots.

Chapter 2, Working with Johnny-Five, covers the basics of Johnny-Five, including Read-Eval-Print-Loop (REPL), and we will build our first project.

Chapter 3, Using Digital and PWM Output Pins, covers basic output devices, using both digital and PWM pins.

Chapter 4, Using Specialized Output Devices, covers specialized outputs that use one or multiple pins.

Chapter 5, Using Input Devices and Sensors, covers input devices using analog and GPIO pins.

Chapter 6, Moving Your Bot, covers basic servo and motor usage with Johnny-Five.

Chapter 7, Advanced Movement with the Animation Library, covers the Animation Library and how to create advanced movement schemes for your NodeBots.

Chapter 8, Advanced Components – SPI, I2C, and Other Devices, covers the use of I2C, SPI, and other advanced components with Johnny-Five.

Chapter 9, Connecting NodeBots to the World, and Where to Go Next, covers how to connect your NodeBots to the Internet and use Johnny-Five code with platforms other than Arduino.

What you need for this book

You will need the following factors before you start working on the book:

  • A basic working knowledge of JavaScript and Node.JS

  • A computer with USB ports that supports node-serialport, running Node.JS 4.x

  • An Arduino Uno or other board supported by Johnny-Five (see http://johnny-five.io/platform-support) and a USB cable for the board

  • Light-Emitting Diodes (LEDs) - having a dozen should let you finish all the examples with room for error.

  • A Piezo element

  • A character LCD (one with an I2C interface is fine)

  • A push-button that is breadboard friendly

  • A rotating potentiometer that is breadboard friendly

  • A light-sensing diode

  • A basic temperature sensor

  • Three hobby servos that runs on 5V

  • One hobby motor that runs on 5v

  • An ADXL345I2C Accelerometer

  • An LED matrix kit from SparkFun—product number DEV-11861

  • A GamePad—RetroLink N64 controller or a DualShock3

  • (Optional) A Particle Photon microcontroller

Who this book is for

If you've worked with Arduino before or are new to electronics and would like to try writing sketches in JavaScript, then this book is for you. A basic knowledge of JavaScript and Node.js will help you get the most out of this book.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "For instance, the LED object has an on() and off() function that turns the LED on and off."

A block of code is set as follows:

var myPin = new five.Pin(11);
myPin.on('high', function(){
console.log('pin 11 set to high!');
});

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

var myPin = new five.Pin(11);
myPin.on('high', function(){
console.log('pin 11 set to high!');
});

Any command-line input or output is written as follows:

> node LED-repl.js

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Now, we'll build a couple of projects that demonstrate how to use more advanced sensors: a photocell and a temperature sensor."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from: https://www.packtpub.com/sites/default/files/downloads/3347OS_ColoredImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.

lock icon The rest of the chapter is locked
You have been reading a chapter from
Learning JavaScript Robotics
Published in: Nov 2015 Publisher: ISBN-13: 9781785883347
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}