<< Back

Exercise 2.1 - Lights and Buttons

f) Random colors

This is the console. All output created with writeLog() is shown here.

Press the RGB LED button (hardware) to change the LED's color randomly between green, red, blue and orange with every click of the button.


script.js

This is the JavaScript code behind the above application.