Programming for the Particle Core

As I mentioned before, we can't use the Arduino IDE to program the Particle Core board since the Arduino IDE has no support for this type of board at the time I am writing this book. But using the Arduino IDE to program the Particle Core is to miss of the point of using them a bit. Since these boards implement Wi-Fi technology, we can program them wirelessly, which might be a huge benefit in some cases and especially when it comes to wearable projects. Debugging a wearable project is a pain sometimes if you constantly have to be connected to a computer in order to make changes to the code. So wireless programming alone is a reason for considering the Particle Core for a wearable project. Then we also have a connection to the Internet, which makes for some really interesting projects.

In order to make these projects, we need to be able to program the Particle Core, and Particle, the company behind the Particle Core, has developed a web-based IDE that can be accessed at the following link: https://build.particle.io/login.

This link will direct you to a login screen where you log in with the account information used to create an account through the phone app. When you have logged in, it should look something like Figure 8.3:

Programming for the Particle Core

Figure 8.3: The web IDE

As you can tell from Figure 8.3, this IDE looks a bit different from the Arduino IDE but the basic functions remain the same. To the left you have your basic operations. First, at the top you will find a button marked with a small lightning, which is the flashing button that is equivalent to the upload button in the Arduino IDE. This button pushes the code from the web IDE to the Particle Core board. Since this is done over Wi-Fi, the flashing will not be as fast on a regular Arduino board. But usually, it does not take more than a few seconds. In order to test the flashing of code, add the following code to the web IDE in the code input area, which is the large dark grey space shown in Figure 8.3:

int led = D7;

void setup(){
pinMode(led,OUTPUT);
}

void loop(){
digitalWrite(led,HIGH);
delay(1000);
digitalWrite(led,LOW);
delay(1000);
}

As you might have guessed, the code will turn the blue LED next to the USB port on and off with a 1 second delay. Now try flashing the code to your Particle Core board. If you are on the same Wi-Fi, the IDE should automatically find your board and upload the code. The RGB LED should turn to cyan and start to blink when flashing the board. Once the flashing is done, the RGB LED should turn back to a pulsating magenta and the blue LED should start to blink.

Below the Flash button, you will find a Verify button and under this one, you will find a Save button. Both have the same function as in the Arduino IDE. A bit further down, you will find five more buttons. The first one hides and shows the code panel where you can find your saved sketches and recently used ones. Next you have the Libraries where you can search for all the available libraries. The Docs button will direct you to a tutorial page with more information about the Particle Core and available services. Below the Docs button, you will find the Device button, which shows/hides the available devices connected. The last button is the settings button, where you can change your password and find your access token, which might be needed for some services to connect to the Particle Core.

Programming for the Particle Core

Figure 8.4: The IDE menu buttons

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.202.167