   _setPwmWrite: (pinNumber) =>
     pwm = new mraa.Pwm pinNumber
 
+  _writePin: (pin) =>
+    return unless _.contains ['digitalWrite', 'pwmWrite'], pin.action
+
+    @_digitalWrite pin.number, pin.value if pin.action == 'digitalRead'
+    @_pwmWrite pin.number, pin.value if pin.action == 'pwmWrite'
+
+    {
+      action: pin.action
+      number: pin.number
+      value:  pin.value
+    }
+
 module.exports = Tentacle

      @emit 'error', error

  onMessage: (message) =>
    return unless message?.payload?

    @messageTentacle _.extend({}, message.payload, topic: 'action')


  onConfig: (config) =>
    @_clearBroadcast()


    @config.pins, (pin) =>
      try
        @_setPinAction pin
      catch error
        @emit 'error', error

