Grove_Button

Grove connectable Button.

wired(obniz, { signal [, vcc, gnd]});

name type required default description
signal number(obniz Board io) yes   Signal pin of state output(4 pin of Grove)
vcc number(obniz Board io) no   VCC for button(2 pin of Grove)
gnd number(obniz Board io) no   GND for button(0 pin of Grove)
// Javascript Example
var button = obniz.wired("Grove_Button", {gnd:0, vcc:1, signal: 3});
button.onchange = function(voltage) {
  console.log(voltage);
}

onchange = function(pressed){}

called when button pressed/released.

// Javascript Example
var button = obniz.wired("Grove_Button", {gnd:0, vcc:1, signal: 3});
button.onchange = function(pressed){
  console.log("pressed:" + pressed)
};

[await] isPressedWait()

Check current button with waiting result.

// Javascript Example
var button = obniz.wired("Grove_Button", {gnd:0, vcc:1, signal: 3});
var pressed = await button.isPressedWait();
console.log("Pressed = " + pressed);

[await] stateWait()

Wait until push/release button.

// Javascript Example
var button = obniz.wired("Grove_Button", {gnd:0, vcc:1, signal: 3});
await button.stateWait(true); 
console.log("button pushed!");
await button.stateWait(false); 
console.log("button released");


Found at :




You will Get in Few Days

Circuit for Starter “obniz Board” is available on Amazon and other online stores.
You can get it at below

Our products and resellers

Forum

Visit our developer’s forum to discuss and discover technologies.

Forum

Contact

Feel free to contact out support and technical team.

Contact us