Document

obniz Hardware and cloud specifications.

Solenoid

Solenoid is a coil with pistone.

Solenoid consume much energy.
You can connect only Tiny Solenoid directly to an obniz.
It's resistance should be more than 5 Ohm.

obniz.wired("Solenoid", {signal, [, gnd]})

Connect two wires to an obniz.
Most solenoids has no polarity.

// Javascript Example
var solenoid = obniz.wired('Solenoid', {gnd:0, signal:1});
solenoid.click();

on()

Turning on a solenoid.
Be careful! Your solenoid will start be heated.

// Javascript Example
var solenoid = obniz.wired('Solenoid', {gnd:0, signal:1});
solenoid.on();

off()

Turn off a solenoid

// Javascript Example
var solenoid = obniz.wired('Solenoid', {gnd:0, signal:1});
solenoid.on();
await obniz.wait(1000);
solenoid.off();

click(msec);

It works on->wait->off.
msec is optional. default is 100msec.

// Javascript Example
var solenoid = obniz.wired('Solenoid', {gnd:0, signal:1});
solenoid.click();

doubleClick(msec);

It click twice.

// Javascript Example
var solenoid = obniz.wired('Solenoid', {gnd:0, signal:1});
solenoid.doubleClick();


Found at :