Hi - im pretty new to programming but have completed a few projects that turn data into physical actions. My latest project i really want to build is a RGB lamp that connects to this API http://wefeel.csiro.au/#/ in particular this http://wefeel.csiro.au/api/emotions/primary/totals and displays a colour based on the returned emotion eg:
I would like the photon to take the highest value and return a colour so IF “love” is the highest number return ‘RED’ or if its “anger” = “FLASH ORANGE”
I’d agree with @Moors7, why not use Particle webhooks and do the whole lot on the device.
The webhook would only relay the data to your device and then you’ve got all the logic in one place.
you get data from the event, so you need to process that into usable data.
One way would be to add a Response Template (mustache template) to your Integration/WebHook and get just deal with the numbers(if that is all you are really interested in).
Another approach would to be to use the JSON parser library (a couple available if you search this site) to extract the values from the JSON object you received in data.
Unfortunately my knowledge of programming is very limited so im unsure how to start ‘sorting’ the numbers and emotions so i can display the highest value as a LED colour. Ive spent hours searching and trying to learn more and came across this brilliant tutorial http://www.connected-displays.com/tutorial/photon-rain-led-tutorial/ i have tried my best to configure it to the API im working with and its given me a great understanding of how to extract specific data using webhooks & mustache.