The REPL – a powerful tool in Johnny-Five
Debugging our LED can be tricky. Without rewiring things, how can we tell if our green and blue channels are flipped, or if the red is far brighter than the other channels? One tool that is very helpful for debugging Johnny-Five projects is the Read–Eval–Print Loop (REPL).
How does the REPL work?
If you have worked with Node.js, Python, or a few other interpreted languages in the past, the REPL may not be new to you. It allows you to write statements into the CLI at runtime to generate results straight from the language engine. This can be very helpful when debugging code, as you can get a glimpse into and modify the state of code at runtime. This is also true in Johnny-Five: the REPL allows us to insert Johnny-Five objects, so we can look at manipulating them at runtime. We're going to use this to play with our RGB LED and control it from the command line.
Adding our RGB LED to the REPL
Take a look at the Johnny-Five documentation for the REPL; it...