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

      pin: new noflo.Port 'number'
      in: new noflo.Port 'boolean'

    @inPorts.pin.on 'data', (pinNumber) =>
      @stopGpio()
      @pinNumber = pinNumber

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

  shutdown: () ->
    @stopGpio()
