I’ve written an Internet of Things instructable to document my home project.
http://www.instructables.com/id/Arduino-Yún-With-DHT22/
I’ve written an Internet of Things instructable to document my home project.
http://www.instructables.com/id/Arduino-Yún-With-DHT22/
I have launched a project exploring some aspects of moving the development of an AVR MCU from the AVR/C++ world to the MIPS Linux/JavaScript world.
Code example:
// PWM glowing example. // Copyright (C) 2015 Imre Horvath // // Build a circuit using a breadboard like this: // Arduino Yun digital pin 11 (PWM) --> 270 R 5% --> 5 mm LED --> Arduino Yun GND // // This code below will cause the LED to glow first brighter and brighter gradually, // then it will glow dimmer and dimmer till off. // And then, this will repeat forever. var firmata = require('firmata'); var board = new firmata.Board('/dev/ttyATH0', function (err) { var pwmPin = 11; var value = 0; var up = true; var incr = 10; if (err) { console.log(err); return; } function cleanExit() { board.reset(); process.exit(); } process.on('SIGTERM', cleanExit); process.on('SIGINT', cleanExit); board.pinMode(pwmPin, board.MODES.PWM); setInterval(function () { board.analogWrite(pwmPin, value); if (up) { if (value < 250) { value += incr; } else { up = false; value -= incr; } } else { if (value > 0) { value -= incr; } else { up = true; value += incr; } } }, 125); });
Actually all the parts to assemble a system for experimenting are available.
It is an interesting idea to program an MCU in JavaScript, because of the language’s powerful features like closures, first-class function objects and higher-order functions. These features enable enormous expressive power compared to plain C/C++.
However transferring control from the AVR to the Embedded Linux on-board through a serial line (57600 baud) and the Firmata protocol on top of it, might render this idea useless for time critical real-time applications.
Also a lot of low-level (C/C++) libraries are available for the Arduino platform like the Arduino-IRremote which are unavailable and unusable on the Node.js side. While other low-level libraries like the one for controlling a WiFi shield are rendered unnecessary when using a Yun with the Linux side which already has WiFI capabilities.
Check out my GitHub repo on the topic!