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.
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 it's a place where you can write code for whatever platform you're using. So you've got the Arduino IDE, Particle IDE, plenty of other IDEs out there, but we're going to look at getting started with your particle boards and the Particle IDE.
So if you're not familiar with what the Particle brand is, take a look at some of our other tutorials which cover getting started with the different particle boards. I've got the Photon here, the Wi-Fi enabled board, you've also got the Electron which is a 3G cellular enabled board, but today we're just going to look at how we can write code, use 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're going to use that for claiming your devices, using the IDE, etc. But once you've done that, go to build.particle.io, and this is the IDE section of the website, and it's going to load up. So log in if you haven't already, and we're going to take a look at the main components of the IDE.
So broken up into three sections, you've got this section here which is 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, and then you've got the menu area. So this is where the different 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 that I've made, that's in the code tab.
Now this third section here is the menu tab, panel, whateverYou like to call it, and it just controls what's been displayed in this panel here.
So next up we've got the libraries section. So particle libraries are community driven, so people can upload their own libraries and they'll be put onto 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're popular, whether they're going to work, whether they're tested or not, so you're not just going completely blind.
And the awesome thing is they've made it so easy to get started. If you've ever used Arduino, you're going to feel right at home here, because it's based around the same software abstraction called wiring. So you'll notice that you've got the very familiar void setup, void loop all here, 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, say we wanted to add a NeoPixel library, and it's going to tell us whether the 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're all compatible with the examples, they'll 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 that's where you know you've got your data sheets, you've got information about the firmware, the boards, cloud functions, all that kind of thing.The information section. Next up we've got devices, so this is where you can view and monitor your different devices, so I've got a few photons, a couple of electrons, I like to give them Australian names, it just helps me identify which one they are, and that star is which one you're targeting with your code, so actually none of my photons are online at the moment, so if I tried to upload code to them I'd get an error message, but we'll get to that in a second.
Here you can view the device ID and the firmware version that it's on here. Now we've got the console, so we've covered the console in a previous tutorial, check out our Getting Started with the Particle Cloud, go into it in a bit more depth there, and then we've got settings, which is your account settings, your access tokens, you can reset that, 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 on board LED here, D7, 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 let's go ahead and plug it in with our micro USB 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 into programming it over the air, so we're going to send our code via our WiFi connection onto the board.
So I've actually already got this code pre-loaded onto 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, we're just declaring thePin D7 is set as an output. Then, the pin is set high and we wait for a second. After that, the pin is set low and we wait for another second. This process is looped in our main loop.
To upload the code, there are three buttons at the top. The first button is "save," which saves the code you are working on. The second button is "verify," which compiles the code and checks for syntax errors or invalid functions. If there are no errors, it will show "verified." If there is an error, it will display the specific issue, such as a missing semicolon.
The third button is "flash," which not only compiles the code but also uploads it to the Photon board. You can either click "verify" to check the code before uploading or directly click "flash" to compile and upload in one step.
It is important to ensure that the correct device is targeted before flashing the code to the Photon board.Derek, because I can see that that's online, and I'm going to go back to our code tab, we don't really need to, I'm going to go flash, and now this is going to go through and compile it, and in a minute you'll see the board reset, there we go, so it's going through the reset process there, connecting to the cloud here, and it's running the code, which is awesome, now that's the Photon, and it's flashing it over the air via Wi-Fi, you can flash it locally, so using the USB cable, or 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, you know, I select the Electron here and go flash, it's going to bring up this message here, letting you know that you're trying to flash to an Electron, 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 it's better just to do it via serial, so check that tutorial out if you're interested in that, and yeah, that's pretty much the IDE in a nutshell, we've just written our first program, created an application, it's on our board now, and that's, you know, 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 design that fits in well with the Particle brand, so go on there, build.particle.io, check it out for yourself, get some projects going with either the Particle or the Electron boards, and yeah, check out some of our other tutorials for getting started with different technologies.And expansions and things like that, and yeah, that's all for now guys. Have a great day. See ya.
Makers love reviews as much as you do, please follow this link to review the products you have purchased.