Constructor
new Pin(nr, type, mode, pwm, tickSupplier)
Represents a hardpare io-pin within an IOBank. This handles keeping
of the basic pin state and PWM, if enabled.
Parameters:
Name | Type | Description |
---|---|---|
nr |
Number | pin number |
type |
String | 'gpio' or 'adc' |
mode |
String | 'in' or 'out' |
pwm |
Boolean | true, if PWM should be enabled, otherwise false |
tickSupplier |
Object | an object, which has a getTicks()-function to tell the pin how much time has passed. Only needed when PWM is enabled. |
- Source:
Methods
getJSON() → {Object}
generates a json representation of the current pin state and its properties
- Source:
Returns:
- Type
- Object
setState(state, ignorePwm)
updates the pin state. If PWM is enabled and ignorePwm is not false
Parameters:
Name | Type | Description |
---|---|---|
state |
Number | state (0 or 1) to set |
ignorePwm |
Boolean | true if all PWM code should be skipped and the PWM status reset |
- Source: