empowering creative people

Videos / Particle IDE Tutorial - Getting Started

The Particle IDE is where IoT magic all comes together. From the one area you can manage your army of Internet connected devices, update firmware and explore open source resources from the best maker friendly brands / people around the world.

Search Videos

Related Content



Hey guys, Sam here from Core Electronics and today we’re going to be taking a look at getting started with the Particle IDE. Now IDE you might ask stands for integrated development environment and its a place where you can write code for whatever platform you are using. So you’ve got the Arduino IDE, Particle IDE and plenty of other IDE’s out there but we’re going to have a look at getting started with your Particle Boards and the Particle IDE.  So if you’re not familiar with what the Particle brand is then take a look at some of our other tutorials which cover getting started with the different particle boards. We’ve got a Photon here, WiFi enabled board, you’ve also got the Electron which is a 3G cellular enabled board. But today we’re going to just take a look at how you can write code, use the libraries and get that uploaded to our boards. So the first thing we want to do is if you haven’t already, go to Particle.Io and make a new account you can use that for claiming your devices using the IDE. Once you’ve done that go to build.particle.io and this is the IDE section of the website and its going to load up, so log in if you haven’t already. So we’re going to take a look at the main components of the IDE so its sort of broken up into 3 sections. You’ve got this section here where you write your code, you view it, you edit it, you’ve got compilation messages that will come up, you’ve got this little message section down here. Then you’ve got the menu area - so this is where the different kind of options and settings for whatever tab you’re on will be displayed.  So I can make a new app, I can look at existing apps I’ve already made and that’s in the code tab. Now this third section here is the menu tab panel - what ever you like to call it! and it just controls what’s being displayed in this panel here. So next up we’ve got the library section, so Particle Libraries are community driven. People can upload their own libraries and they’ll be put on to the Particle IDE here and you can actually see how many people are using them to get a bit of an idea of whether they are popular, whether they are going to work, whether they’re tested or not.  So you’re not going in completely blind and the awesome thing is that they’ve made it so easy to get started. If you’ve ever used Arduino then you’re going to feel right at home here because its based around the same software abstraction called wiring so you’ll notice that you’ve got the very familiar void setup - void loop, and that’s because that’s how wiring works. It’s really easy to get started and if you’ve never used anything before you’ll find it just as easy to get started.  So that’s the library so we can go in and say we wanted to add a neopixel library and it’s going to tell us whether the existing examples are compatible with the type of board we’re using, whether they work. So we’ve got core, which is an older kind of board, the P1 which is actually the module here, you can get that by itself to make your own boards - photon and the electron - they are all compatible with the examples and they work straight out of the box so that’s fantastic. Now we can use it in the example, we can modify it however we want - so that’s the library section.

You’ve got the Docs which will take you to the reference section, so I think it’s docs.particle.io and thats where you’ve got your data sheets and you’ve got information about the firmware, the boards, cloud function - all that kind of thing, the information section.

Next up we’ve got devices. This is where you can view and monitor all your devices. I’ve got a few photons, a couple of electrons - I like to give them Australian names! It just helps me identify which ones they are and that star is which one you’re targeting with your code.  So actually none of my Photons are off line - are ONLINE sorry, at the moment so if I try to upload code to them I’d get an error message. We’ll get to that in a second.

You can view the device ID and the firmware version thats it’s on here.

Now we’ve got the console and we’ve covered the console in a previous tutorial so check out our getting started with the Particle Cloud, we go into it in a bit more depth there.

Then we’ve got settings which is your account settings, your access tokens, you can reset that and change your password etc etc.

So let’s go ahead and write a program. I’ve got my Photon board here and we’re going to write the Hello World of Electronics which is a blink program. So there’s an onboard LED here at D7 (if you can see that) and we’re just going to write a program that turns it on, waits for half a second, turns it off, waits for half a second - so it’s just going to be blinking. So lets get going and plug it in with our microUSB cable. Now even though I’m connecting it to the computer with the USB cable like you would an Arduino, we’re actually going to go and program it over the air. So we’re going to send our code via our WiFi connection  on to the board.  So I’ve actually already got this code preloaded on to it as you can see but we’ll go through writing it and flashing it from scratch. So I’ve created an example here called ’blink-example-demo’ so it’s really simple you know, we’re just declaring that pin D7 is an output, then setting that pin high waiting for a second, then setting it low and waiting for a second and we’re looping that in our main loop, there!  Now if you want to upload this you’ve got three little buttons up the top here. You’ve got save which saves your code that you’re working on, you’ve got verify which is going to try to compile your code. Now what this means is it takes the really easy to read C++ code here which  the Particle IDE is based around C++ with the wiring abstraction and it compiles it. It turns it into a type of code that is a lot easier for our little computer brain in here to understand. It pretty much checks that your syntaxes are correct, that you’re not using invalid functions. So if we go verify, you can see down the bottom here it’s compiling and it’s verified and that means there are no errors. It still might not work as intended but at least it’s a valid code. If we delete this semi colon here and try and verify it, it’s going to attempt to do it then let us know that there is an error.  So error! It expected that semi colon here, so we’ll go ahead and add that in and re verify it and it will be all good.

Now the third button we’ve got here is flash, and this is where we obviously flash this code to the Photon board. Now it’s important to note that flash also compiles it so you don’t have to do that separately, you can just click verify if you just want to check your code is good before uploading or you can flash it and do it all in one. So we want to make sure we’ve got our device targeted - so whoops, didn’t have the right one and it would have let me know that there’s an error.  So I’m going to target Photon Derek - you can see that that’s online -  and I’ll go back to the code tab although you don’t really need to and I’m going to go flash. Now this is going to go through and compile it and in a minute you’ll see the board reset - here we go, so it’s going through the reset process there. It’s connecting to the cloud here and it’s running the code which is awesome. Now that’s the Photon and its flashing it over the air via WiFi - you can flash it locally using the USB cable over USB or Serial using the command line interface (we go into that in the getting started with Electron tutorial so check that out). But if I do go and select the Electron here and go flash it’s going to bring up this message here letting you know that you are trying to flash to an electron and it’s going to use up some of that precious data because it’s a 3G board - do you want to go ahead essentially which is really handy in case you don’t want to accidentally chew through that data - not realising. You can flash it over the air with the Electron but generally its better just to do it via serial. So check that tutorial out if you’re interested in that.

So that’s pretty much the IDE in a nutshell, we’ve just written our first program, created an application that’s on our board now, and that’s all the features of the IDE. It’s really simple and really intuitive but it’s also really powerful. It’s got a great user interface, really sleek line that fits in well with the Particle brand. So go on there, build.particle.io - check it out for yourselves and get some projects going with either particle or the electron boards and check out some of our other tutorials for getting started with different technologies and expansions and things like that.

Thats all for now guys, have a great day :-)