Reader small image

You're reading from  Learning JavaScript Robotics

Product typeBook
Published inNov 2015
Reading LevelIntermediate
Publisher
ISBN-139781785883347
Edition1st Edition
Languages
Tools
Concepts
Right arrow
Author (1)
Kassandra Perch
Kassandra Perch
author image
Kassandra Perch

Kassandra Perch is an open web developer and supporter. She began as a frontend developer and moved to server-side with the advent of Node.js and was especially enthralled by the advance of the NodeBots community. She travels the world speaking at conferences about NodeBots and the fantastic community around them.
Read more about Kassandra Perch

Right arrow

Understanding events in Johnny-Five


The events in Johnny-Five are a very important concept—this is also a new concept, especially if you are used to low-level language programming. It's very similar to the idea of interrupts, but definitely strays away from the traditional robotics programming paradigm of an event loop. While you can create timers and loops in Johnny-Five, it highly encourages an event-based programming approach, which can need some practice.

Why events?

A question that gets asked a lot is, "Why event-based? Why not loop-based and interrupt-based as in previous methods?".

A lot of this has to do with the way robots work and the way we think about how we program robots. When you think about what you want a robot to do, you're less likely to think "Every X seconds, I want to check for A and start task B..." and you are more likely to think "When Y happens, I want to start event C...".

The event-based system in Johnny-Five works really well with this train of thought by allowing...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Learning JavaScript Robotics
Published in: Nov 2015Publisher: ISBN-13: 9781785883347

Author (1)

author image
Kassandra Perch

Kassandra Perch is an open web developer and supporter. She began as a frontend developer and moved to server-side with the advent of Node.js and was especially enthralled by the advance of the NodeBots community. She travels the world speaking at conferences about NodeBots and the fantastic community around them.
Read more about Kassandra Perch