In the last post we built a couple different circuits with the Particle Photon and controlled it via our phone. In this post I will open up Particle Build and go through their documentation. Visit our first post on getting started from the beginning.
To begin, I created and saved an app I named Johnny. In their documentation I will use ‘blink an LED’ to flash to the photon first. When you click on their example app it will show up in the screen. The ‘blink an LED’ one is heavily commented, which is useful for beginners. After plugging in my photon I clicked the lightning bolt in the top left corner and the photon flashed a few times, then started blinking like it should.
The documentation goes on to talk about your device ID, API key, libraries, and code memory usage. This is all very important information and you easily explore these topics more in depth.
The firmware is also discussed, including the fact that the Particle Photon’s software can be updated easily since it is already connected to the internet.
Find the Temp
Now we get to the Code Examples. I encourage you to work through them as they are very well documented. In general, I have found that Particle’s documentation is so well written that I haven’t had a whole lot to add in terms of getting up off the ground and running.
Anyways, here is what I did: I used the temperature setup from the previous post. And then, borrowing from a tutorial in “Arduino Workshop“, I wrote some code in Particle Build. Here it is: [purchase_link id=”2555″ style=”button” color=”blue” text=”Download Particle Build File”]
I commented the code, but I’m hoping it is relatively simple. Here is what you need to do next:
- Copy and paste the code into your particle build
- Build the physical circuit (diagram can be found here)
- Flash the app to your particle photon (should be connected and ‘breathing cyan’ as they say)
- Once breathing cyan after uploading, it should be functioning
Now you will need two things, both can be found on Particle Build:
- Device ID
- Access Token
Since we are using Spark.variable instead of Spark.publish, we won’t be able to see the results on the Particle dashboard. The reason we aren’t using Spark.publish is because we are wanting to see a variable, and publish will only send text (at least as far as I can tell. This is ok). Here are the Docs for the Spark functions. Spark.variable supports ‘double’ variables, so that’s what we are using for the Fahrenheit variable.
Once your photon is connected, it should be sending that variable to the cloud. You can access it by sending a GET request of this format:
Insert your Device ID and Access Token and put that baby in the browser. You should get a result similar to this:
Particle Photon Wrap Up
Follow me on Twitter for new post updates!
Comment below, let me know how I’m doing.
I’m working on some projects, so check back! I finally posted a downloadable file, I hope to do more with the Particle Photon in the future. Also I will be purchasing a Particle Electron soon so stay tuned. They ship in January.
If you have a tutorial I would be more than happy to post it! Message me on Twitter or email to email@example.com