# Input MQTT + Output Debug

## @ Node-Red Flow Space

> Input Mqtt
>
> > Server test.mosquitto.org:1883\
> > Topic IBMIoT/NodeRed/IntelEdison
>
> Output Debug
>
> > Output Message Property\
> > msg.payload
>
> Function Function
>
> > Name MyFunction\
> > Function Code See Below

```javascript
if (msg.payload == 'On')
{
    msg.payload = 1
}
if (msg.payload == 'Off')
{
    msg.payload = 0
}
return msg;
```

> Output Gpio
>
> > Board galileo-io
> >
> > > Nodebot Galileo/Edison\
> > > Type Digital (0/1)\
> > > Pin 13

### Source

```javascript
[{"id":"e7025d5c.18fda","type":"nodebot","z":"98b49c15.674b6","name":"","username":"","password":"","boardType":"galileo-io","serialportName":"","connectionType":"local","mqttServer":"","socketServer":"","pubTopic":"","subTopic":"","tcpHost":"","tcpPort":"","sparkId":"","sparkToken":"","beanId":"","impId":"","meshbluServer":"https://meshblu.octoblu.com","uuid":"","token":"","sendUuid":""},{"id":"744af6bf.8bb508","type":"mqtt-broker","z":"98b49c15.674b6","broker":"test.mosquitto.org ","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":""},{"id":"c89cadcc.37635","type":"debug","z":"98b49c15.674b6","name":"","active":true,"console":"false","complete":"payload","x":591,"y":130,"wires":[]},{"id":"7f0cbf12.80f34","type":"mqtt in","z":"98b49c15.674b6","name":"","topic":"IBMIoT/NodeRed/IntelEdison","broker":"744af6bf.8bb508","x":232,"y":130,"wires":[["c89cadcc.37635","a439a46b.5bc658"]]},{"id":"a439a46b.5bc658","type":"function","z":"98b49c15.674b6","name":"MyFunction","func":"if (msg.payload == 'On')\n{\n    msg.payload = 1\n}\nif (msg.payload == 'Off')\n{\n    msg.payload = 0\n}\nreturn msg;","outputs":1,"noerr":0,"x":444,"y":186,"wires":[["5366e815.ac9918"]]},{"id":"5366e815.ac9918","type":"gpio out","z":"98b49c15.674b6","name":"","state":"OUTPUT","pin":"13","i2cDelay":"0","i2cAddress":"","i2cRegister":"","outputs":0,"board":"e7025d5c.18fda","x":628,"y":186,"wires":[]}]
```

### @ Intel Edison Console

```bash
1459004673454 Connected Intel Edison  
    26 Mar 15:04:33 - [info] [mqtt-broker:744af6bf.8bb508] Connected to broker: mqtt://test.mosquitto.org :1883
```

### @ Another Device

```bash
$ mosquitto_pub -h test.mosquitto.org -t IBMIoT/NodeRed/IntelEdison -m "On"
    $ mosquitto_pub -h test.mosquitto.org -t IBMIoT/NodeRed/IntelEdison -m "Off"
```

### @ Node-Red Debug Tab

```bash
3/26/2016, 9:06:37 AMc89cadcc.37635
    IBMIoT/NodeRed/IntelEdison : msg.payload : string [2]
    On
    3/26/2016, 9:06:41 AMc89cadcc.37635
    IBMIoT/NodeRed/IntelEdison : msg.payload : string [3]
    Off
```

### @ Intel Edison Board

Check the Led tight to GPIO 13 (DS2)

## Intel Edison + Grove Starter Kit

* [Node-RED nodes to support a few Grove Sensors for Intel Edison Arduino Board](http://flows.nodered.org/node/node-red-contrib-socialogix4edison)

```bash
root@edison:~# npm install node-red-contrib-socialogix4edison
    -\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-n
    ��└��─��─ q@1.4.1
    root@edison:~#
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://theiotlearninginitiative.gitbook.io/ibminternetofthings/node-red/projects/input-mqtt-+-output-debug.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
