Example application to switch on/off or blink LED connected to Raspberry Pi GPIO Pins using MQTT Communication
- LED Light
- Resistor
- Raspberry Pi (Any Model)
- osgi.enroute.examples.led.controller.application - Example Application Project
- osgi.enroute.examples.led.controller.core.api - LED Controller API
- osgi.enroute.examples.led.controller.core.provider - LED Controller Service Implementation
- osgi.enroute.examples.led.controller.mqtt.api - MQTT Communication API (Simplified Version)
- osgi.enroute.examples.led.controller.mqtt.provider - MQTT Communication Service Implementation
Before you start executing the following steps, it is advisable to configure the LED with GPIO Pin as mentioned the following image (although the image is an example). As soon as you connect the LED to the GPIO, you can start executing the following steps.
- Run either osgi.enroute.examples.led.controller.bndrun or debug.run
- You can now access the application at http://<IP Address of the Raspberry Pi>:8080
- Update the settings before you play with this tool
- Now you can publish MQTT message (with on or off or blink X payload where X is any integer number) to the specified topic
on - to switch the LED ON
off - to switch the LED OFF
blink X - to blink the LED for X number of seconds (Don't forget to change X to any number)
The following image is an example of connecting LED to GPIO PIN 1. You can connect to whichever PIN you like.