LED control over Ubidots with switch for Particle Photon


#1

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


#2

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


#3

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.


#4

@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!