       pin: new noflo.Port 'number'
       in: new noflo.Port 'boolean'
 
+    @value = null
     @inPorts.pin.on 'data', (pinNumber) =>
       @stopGpio()
       @pinNumber = pinNumber

  startGpio: () ->
    return unless @pinNumber
    @gpio = gpio.export(@pinNumber, { direction: 'out' })
    @gpio.set(if @value then 1 else 0) if @value

  shutdown: () ->
    @stopGpio()

  setValue: (value) ->
    @value = value
    return unless @gpio
    @gpio.set(if @value then 1 else 0)

  stopGpio: () ->
    return unless @gpio
