Programming the BeagleBone Black: Getting Started with JavaScript and BoneScript

Book description

Program your own BeagleBone Black projects!

Build creative BeagleBone Black devices--no prior programming or electronics experience required. In Programming the BeagleBone Black, electronics guru Simon Monk explains essential application development methods through straightforward directions and cool downloadable examples. Discover how to navigate the board, write and debug code, use expansion capes, and control external hardware. Easy-to-follow plans show you how to wire up and program a Web-controlled roving robot and an e-mail notifier that lights an incandescent lamp.

  • Set up the BeagleBone Black and explore its features
  • Connect to your computer via USB or Ethernet
  • Use the BeagleBone Black as a stand-alone PC
  • Write and execute BoneScript code
  • Use JavaScript functions and timers
  • Perform analog and digital I/O
  • Work with expansion capes and modules
  • Design Web interfaces that control electronics
  • Assemble and program a robot and an e-mail notifier

Table of contents

  1. Cover 
  2. About the Author
  3. Title Page
  4. Copyright Page
  5. Contents at a Glance
  6. Contents 
  7. Acknowledgments
  8. Introduction
  9. 1. Introduction and Setup
    1. What Is the BeagleBone Black?
    2. A Tour of the BeagleBone Black
    3. Example BeagleBone Black Projects
    4. First Boot of the BeagleBone Black
      1. Connecting via USB
      2. Using the USB Network Bridge
      3. Connecting to the BeagleBone Black Web Server
    5. Secure Socket Communication
      1. The GateOne SSH Client
      2. SSH from the Mac or Linux Terminal
      3. SSH on Windows Using PuTTY
      4. Using the Linux Command Line
    6. Ethernet Connection
    7. Upgrading the Operating System
      1. Downloading the Disk Image
      2. Extracting the Disk Image
      3. Installing the Disk Image on the SD Card
    8. Summary
  10. 2. A Linux Computer
    1. Attaching the Keyboard, Mouse, and Screen
    2. Setting the Date
    3. Wi-Fi
      1. Step 1: Upgrade
      2. Step 2: Install the Driver
      3. Step 3: Configure
      4. Step 4: Test
    4. Bundled Software
    5. Installing More Software
    6. Summary
  11. 3. JavaScript Basics
    1. Programming
      1. Operating System
      2. What Is a Program?
      3. Programming Environment
    2. Cloud9 Web IDE
    3. JavaScript, Node, and BoneScript
      1. JavaScript
      2. Node
      3. BoneScript
    4. Experimenting
    5. Numbers
    6. Variables
    7. Strings
    8. Dice Example
    9. Ifs
    10. Looping
    11. Turning on USR LEDs
    12. Summary
  12. 4. JavaScript Functions and Timers
    1. More on Ifs
    2. Functions
      1. A Dice-Throwing Function
      2. Naming Functions
      3. The Function Body
      4. Locals and Globals
      5. Function Parameters
    3. While Loops
    4. Timers
      1. No Sleeping
      2. Interval Timers
      3. Blinking an LED with set Interval
      4. setTimeout
      5. Cancelling an Interval Timer
      6. Anonymous Functions
    5. Summary
  13. 5. Arrays, Objects, and Modules
    1. Arrays
      1. Creating Arrays
      2. Accessing Elements of an Array
      3. Modifying Arrays
      4. Sorting Arrays
      5. Iterating Over Arrays
    2. Morse Code Example
      1. Flashing All Four LEDs at Once
      2. Blinking SOS
    3. More on Strings
    4. Introducing JavaScript Objects
    5. Morse Revisited
    6. Debugging JavaScript
    7. Modules
    8. Summary
  14. 6. BoneScript
    1. GPIO Connectors
    2. Digital Outputs
    3. Digital Inputs
    4. Analog Outputs
    5. Analog Inputs
    6. Interrupts
    7. Summary
  15. 7. Hardware Interfacing
    1. Solderless Breadboard
    2. LEDs
    3. Switches
    4. RGB LEDs
    5. Switching AC
    6. Temperature Sensor
    7. Light Sensor
    8. Servos
    9. Using a Transistor
    10. Summary
  16. 8. Using Capes and Modules
    1. Breadboard Cape
    2. Proto Cape
    3. Battery Cape
    4. LCD Cape
    5. Motor Driver Module
    6. I2C
      1. The node-i2c Library
      2. Interfacing with an I2C Display
      3. Interfacing with Serial GPS
    7. Summary
  17. 9. Web Interfaces
    1. How Does It Work?
    2. Some Basic HTML
    3. On/Off LED Control
    4. LED Brightness Control (Analog Outputs)
    5. Displaying Digital Inputs
    6. Displaying Analog Inputs
    7. Custom Actions
    8. Inputs and Outputs Together
    9. Summary
  18. 10. A Roving Robot
    1. Hardware
      1. Step 1: Assemble the Magician Chassis
      2. Step 2: Attach Header Pins to the Motor Module
      3. Step 3: Wire Up the Breadboard
      4. Step 4: Connect All the Parts
    2. Software
    3. Summary
  19. 11. E-mail Notifier
    1. Hardware
      1. Step 1: Attach Leads to the Lamp
      2. Step 2: Attach Pins to the Proto Cape
      3. Step 3: Solder Components to the Proto Cape
      4. Step 4: Attach the Lamp to the Proto Cape
      5. Step 5: Connecting the Power Supply
    2. Software
    3. Summary
  20. A: Parts
    1. Suppliers
    2. Breadboard Starter Kits
    3. BeagleBone and Capes
    4. Modules
    5. Electronic Components
    6. Tools and Prototyping
    7. Miscellaneous
  21. B: JavaScript Quick Reference
    1. Core Language
    2. Strings
    3. Arrays
    4. Objects
    5. Math
    6. Dates
  22. C: BeagleBone Black GPIO Pinout
  23. Index

Product information

  • Title: Programming the BeagleBone Black: Getting Started with JavaScript and BoneScript
  • Author(s): Simon Monk
  • Release date: May 2014
  • Publisher(s): McGraw-Hill Education TAB
  • ISBN: 9780071832137