How to get info via API and view it in a webpage

So I am new to the Photon/Particle platform (just got it yesterday) and tinkering in any real aspect. I’ve blinked LEDs on a few things in the past and that’s about it. However I decided I have an idea that is worth pursuing so here I am learning.

I’ve read through most of the guides at particle.io/start and have a basic understanding of what I am doing. I have some basic firmware pushed out that reads a pin and will send the value out to the cloud (using the photoresistor right now). Where I am running into problems is on the HTML and jQuery/Javascript side. I have played with javascript stuff in the past but lost most of it and never did anything interacting with API’s and am feeling lost.

I have my code up here https://github.com/thechainercygnus/fluffy-octo-moo/tree/master and would love any insight as to how I can do what I am attempting to do (again that’s read the Analog Value and then print it into the website as it updates)

Thanks in advance for any help provided.

Hi @Chainer

Here is a tutorial I wrote that uses Spark variables and functions and has a complete read/write example:

The basic idea is to read the variables every n seconds and update an HTML value with the read data.

That did it. Thank you a ton. Pretty easy now that I see it.

1 Like