NERP: At Last — A JavaScript MCU!
NERP is not exclusively Raspberry Pi, the small computer interest group at Pumping Station:One in Chicago. NERP meets every other Monday at 7pm at Pumping Station:One, 3519 N. Elston Ave. in Chicago.
It was time, perhaps past time for a JavaSscript microcontroller to appear. Tonight Drew Fustini will show us a high-level overview of the Espruino. The Espruino controller board is just emerging from Kickstarter and can be ordered through one of their distributors. http://www.espruino.com/
Lots of people know JavaScript and its programming environment, and many of those people could be convinced to try their hand at using a microcontroller if they could use their preferred programming language – in a Web IDE. This is important stuff, but the really striking thing is that event-driven processes are now in easy reach of people who need the capability but don’t want to learn a real time operating system. A very common question people in their first hour of Arduino programming will ask is “Now how do I blink two LED’s?”. Having spent a lot of time teaching Arduino 101, I can say that it’s always an awkward moment when you say “Well, you can, but it’s really involved”. JavaScript combined with a bit of Arduino vernacular solves the problem in a way that might be expected in an event-driven system. It’s wonderfully short and simple. Snagged and slightly edited from the espruio.com site:
function toggle1() {
on1 = !on1;
digitalWrite(LED1, on1);
}
function toggle2() {
on2 = !on2;
digitalWrite(LED2, on2);
}
setInterval(toggle1, 400);
setInterval(toggle2, 456);
Each time you called setInterval()
, it returned a different number. If you want to change how fast the interval runs (or cancel it altogether) you need to use this number:
changeInterval(1,1000);
or
clearInterval(1);
[end quote]
Almost predictably the CPU is an ARM M-series like so many other of the 32-bit MCU convenience platforms. For instance an M3 type is used in the Espruino and an M4 type is used in the Teensy 3.1. It is unclear to me whether portability of code will carry across different chip makers, but the M3 vs M4 difference per se may not matter. From Element14's community site:
...most features of the Cortex-M3 and M4 are the same with the significant difference that Cortex-M4 has DSP extensions and an optional FPU. There is nearly no need for modification of hardware and software to migrate from M3 to M4. [http://www.element14.com/community/docs/DOC-36208/l/migrating-from-cortex-m3-to-cortex-m4-by-element14 ]
Like the relationship between the Arduino and the ATMega MCU’s from Atmel, there is an Espruino board and Espruino libraries. Also similarly, the libraries are open source and theoretically portable to other boards using the same or similar chip. Some possibilities labeled as “unsupported” are listed on the Espruino site.
Will it become common to pick your ARM board and then pick your development system?
–----------
Also tonight, Ed will talk about some of the issues in making a clock that uses a funky, antique digital display called a “one-plane readout”.
Find NERP and Pumping Station:One
at http://www.meetup.com/NERP-Not-Exclusively-Raspberry-Pi/
and https://pumpingstationone.org/
Doors open at 6:30pm. The next meeting is March 3rd, 2014. NERP is free and open to the public.
Ed Bennett ed @ kinetics and electronics com
Tags: electronics, embedded, NERP, Open Source, raspberry pi, hackerspace, Beagle Bone, Element14, Pumping Station One