[SOLVED] LED control over Ubidots with switch for Particle Photon

Hello,
I am trying to put 4 LEDs and control them over the Ubidots dashboard with a switch. However, I could not do it with the Ubidots library available on the build.particle.io. Could someone please guide me, a newbie in all of these? Any and all help is appreciated. @mariahernandez I was looking for the pictures because I was trying to find out how to do this.
Kind regards,
Kerem Ulcay

Greetings, you can do that using MQTT, this video may serve you as reference: https://www.youtube.com/watch?v=ynhJ4YhhQEM

You can use the MQTT particle library as starter point: https://github.com/ubidots/ubidots-particle-mqtt/blob/master/examples/UbidotsSubscribe/UbidotsSubscribe.ino

All the best

1 Like

Hello Karem!

At first, welcome to Ubidots :smiley: :blue_heart:

You can establish the communication between Ubidots & Particle in two ways:

  1. Using Ubidots Particle Library
  2. Using Particle Webhook

By using the Ubidots Particle Library you should call the get or getValueWithDatasource method with the identifier or label of the variable desired to be controlled. In the following link you will find the sample code of how to use both methods. In your case, you need to obtain 4 different variables in order to control the 4 LEDs.

Once you are able to receive the values in Particle from the Ubidots variable, then you need to establish the logic in your code in order to start controlling the LEDs based on the value received from Ubidots.

By using Particle Webhook you should refer to the step #3 of the guide provide. Over there you will find how to control just one variable, so in your case, you need to repeat the same process for each variable.

I hope all this information help you to start with your IoT project! :smiley:

All the best,
Maria C.

2 Likes

@mariahernandez @jotathebest I will try both of these today and get back to you soon. Thank you for both of your help :slight_smile: . Have a nice day!

Hello Karem. I am new to the forum.
The link you provided doesnt work.
Could you please update that, as I would also like to view the guide to control a Particle device via ubidots.

Greetings, my advise is to use MQTT, you just need to modify the callback function to your particular firmware routine needs.

All the best

Hi,

when i follow the following link for the sample code, it drive me to unidentified page could you please have a look or send me the link here.

i have tried particle Webhook method and it works but i am not happy about the performance, as if i leave the device for about 10 minutes and then trying to send an order to switch on /off an LED there is no response unless i switch off and on the power from the particle.

so do you recommend to use MQTT or using getValue function,? if so how ?

Many Thanks