Book Image

Learning JavaScript Robotics

By : Kassandra Perch
Book Image

Learning JavaScript Robotics

By: Kassandra Perch

Overview of this book

Table of Contents (16 chapters)
Learning JavaScript Robotics
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

How analog input pins work


Inputs are the first half of awesome robots equations; robots that know the weather, can tell how fast they are moving, or see where things are. Input pins make this possible, so in this section we'll discuss how they work and how we're going to utilize them.

Analog input pins work by reading a voltage level from a sensor and converting this voltage level to an integer value between 0 and 1,023. Input device manufacturers usually give a scale to their device that tells us how to turn this integer value into a real-world value; for instance, we'll do this with our temperature sensor to change the value into a temperature that we as humans can understand.

We're going to utilize these pins by plugging in both the human input devices and the environmental sensors, and map ping the inputs that they give. This way, we can start developing projects that use inputs to generate outputs.