obniz
Version:
obniz sdk for javascript
38 lines (30 loc) • 567 B
JavaScript
class USB {
constructor() {
this.keys = ['vcc', 'gnd'];
this.requiredKeys = ['vcc', 'gnd'];
this.displayIoNames = {
vcc: 'vcc',
gnd: 'gnd',
};
}
static info() {
return {
name: 'USB',
};
}
wired(obniz) {
this.obniz = obniz;
this.io_vdd = obniz.getIO(this.params.vcc);
this.io_gnd = obniz.getIO(this.params.gnd);
this.io_gnd.output(false);
}
on() {
this.io_vdd.output(true);
}
off() {
this.io_vdd.output(false);
}
}
if (typeof module === 'object') {
module.exports = USB;
}