We have a great culture of innovation here at Caplin. That’s why we regularly organise hack days and encourage people to take dev days to work on new and cool technologies. We also invest a lot in education, so we often send our developers to conferences and training classes. Lately we’ve been spending a lot of time at various London JS Night classes. The last one I attended was An Introduction to Arduino with JavaScript, which might seem odd as we don’t have any immediate plans to tackle the problems of FX trading with Arduinos. But that just shows that Caplin doesn’t mind spending resources on its employees to learn new things, even if they are not directly related to our main business.
The class was a really enjoyable experience, there were about six attendees and Lily Madar, the host speaker. She set everyone up with an Arduino board and then we started controlling the psychical world using JavaScript! At first I was a bit sceptical about using JavaScript to program an Arduino as I’m used to using C.
However, once she explained the Breakout framework we used in the class and the possibilities it presents it immediately made sense, and I could see how it’s actually not a bad idea. Especially once you recognise that it’s meant as a prototyping tool only (to use it, your Arduino needs to be connected to your computer with a cable) and not as a replacement for “traditional” Arduino programming. The code that controls the Arduino runs inside your browser (I haven’t explored the possibility of using node.js) which means that you can convert your Arduino (and inputs) into a remote control of sorts. Or do it the other way around and control the Arduino outputs from your browser.
It’s really exciting when clicking a button in the browser causes a physical change in the real world (LED light turns on, a motor starts spinning, …), or when you wire a physical button to the Arduino and it causes your browser to do something. It really took me back to the beginning of my programming days, when everything was new and exciting and full of wonder.
Some of the things we built include: a blinking LED, an LED that changes colour randomly and a colour picker in the browser that sets the colour of the LED. As a final exercise we got to build either a “Simon says” game or a “Etch-a-Sketch”. I opted to build the “Etch-a-Sketch” and again it was really fun to see how rotating two potentiometers on the Arduino was causing lines to appear on the canvas in the browser.
I encourage everyone to get an Arduino and try to build something cool with it, using JavaScript! And below you can see the experiments in action: