Performs exponential calculation on operands. Same algorithm as Math.pow(x, y)
- Commonly used in albegra, geometry, physics and robotics.
- Nice to have "inline" operator
- Python
var five = require("../lib/johnny-five.js"); | |
var board = new five.Board(); | |
function toMV(value) { | |
return five.Fn.map(value, 0, 1023, 0, 5000) | 0; | |
} | |
board.on("ready", function() { | |
var relay = new five.Relay(7); | |
var monitor = new five.Sensor("A0"); |
var $ = require('NodObjC'); | |
$.import('Cocoa'); | |
var installNSBundleHook = function() { | |
var cls = $.NSBundle; | |
if (cls) { | |
var bundleIdentifier = cls.getInstanceMethod('bundleIdentifier'); | |
bundleIdentifier.setImplementation(function(val) { |
var five = require("johnny-five"); | |
var Spark = require("spark-io"); | |
var keypress = require("keypress"); | |
var board = new five.Board({ | |
io: new Spark({ | |
token: "{YOURS}", | |
deviceId: "{YOURS}" | |
}) | |
}); |
var Cylon = require('cylon'); | |
// Initialize the robot | |
Cylon.robot({ | |
connection: { name: 'voodoospark', adaptor: 'voodoospark', accessToken: 'XYZPDQ123', deviceId: '123ABC456', module: 'spark' }, | |
device: {name: 'led', driver: 'led', pin: 'D0'}, | |
work: function(my) { | |
every((1).second(), function() {my.led.toggle()}); | |
} |
/* ServoTimer2.cpp*/ | |
extern "C" { | |
// AVR LibC Includes | |
#include <inttypes.h> | |
#include <avr/interrupt.h> | |
#include "WConstants.h" | |
} | |
#include <wiring.h> | |
#include "ServoTimer2.h" | |
static void initISR(); |
var five = require("johnny-five"); | |
var board = new five.Board(); | |
board.on("ready", function() { | |
/* | |
Assuming a continuous servo is attached to pin 9, | |
this program can be called as: | |
node calibrate-servo.js |
/* MAX7219 Interaction Code | |
* --------------------------- | |
* For more information see | |
* http://www.adnbr.co.uk/articles/max7219-and-7-segment-displays | |
* | |
* 668 bytes - ATmega168 - 16MHz | |
*/ | |
// 16MHz clock | |
#define F_CPU 16000000UL |
var serialport = require('node-serialport') | |
var sp = new serialport.SerialPort("/dev/ttyO3", { | |
parser: serialport.parsers.raw, | |
baud: 9600 | |
}) | |
sp.on('data', function(chunk) { | |
console.log(chunk.toString('hex'), chunk.toString(), chunk) | |
}) |