MCPcopy Create free account
hub / github.com/WebThingsIO/webthing-node / constructor

Method constructor

example/platform/board/flex-phat.js:20–55  ·  view source on GitHub ↗
(name, type, description)

Source from the content-addressed store, hash-verified

18
19class FlexPHatThing extends Thing {
20 constructor(name, type, description) {
21 super('urn:dev:ops:my-flex-phat-1234',
22 name || 'FlexPHat',
23 type || [],
24 description || 'A web connected Flex RaspberryPi Hat');
25 const self = this;
26 this.gpioProperties = [
27 new GpioProperty(this, 'Relay', false,
28 {description:
29 'Actuator (on GPIO5)'},
30 {direction: 'out', pin: 5}),
31 new GpioProperty(this, 'BlueLED', false,
32 {description:
33 'Actuator (on GPIO13)'},
34 {direction: 'out', pin: 13}),
35 new GpioProperty(this, 'GreenLED', false,
36 {description:
37 'Actuator (on GPIO19)'},
38 {direction: 'out', pin: 19}),
39 new GpioProperty(this, 'RedLED', false,
40 {description:
41 'Actuator (on GPIO26)'},
42 {direction: 'out', pin: 26}),
43 new GpioProperty(this, 'Button', false,
44 {description:
45 'Push Button (on GPIO11)'},
46 {direction: 'in', pin: 11}),
47 new GpioProperty(this, 'GPIO23', false,
48 {description:
49 'Input on GPIO 23 (unwired but modable)'},
50 {direction: 'in', pin: 23}),
51 ];
52 this.gpioProperties.forEach((property) => {
53 self.addProperty(property);
54 });
55 }
56
57 close() {
58 this.gpioProperties.forEach((property) => {

Callers

nothing calls this directly

Calls 1

addPropertyMethod · 0.80

Tested by

no test coverage detected