Lab 1 - From Box to Blinky

Project Goal Get your Particle Argon online and claimed to your account
What you’ll learn How to claim a new Particle Argon using the mobile app; How to use the Build Web IDE to flash a device
Tools you’ll need An Argon, the Particle Mobile App, The Build ]Web IDE
Time needed to complete 20 minutes

In this lab, you'll claim your first Particle Mesh device, the Argon, with the help of the Particle mobile app. Once you've claimed it, you'll flash some code that blinks an LED on the Argon.

Did you come prepared?
Make sure you have completed all the prerequisites before advancing beyond this point.

Claim your device

Now you will set up your Argon and claim it to your Particle account.

  1. Open your glorious new Argon Kit. Click on the Wi-Fi antenna to the U.FL connector labeled WIFI. Afterwards, use the USB cable to plug the Argon into your computer. This should power up your device.
  2. Once the Argon powers up for the first time, it will automatically enter "listening mode" (indicated by the RGB LED blinking blue), which means it's ready to be claimed. If you need to actively put your device in to "Listening Mode", hold down the MODE button for three seconds, until the RGB LED begins blinking blue.

  3. Make sure your phone has Bluetooth turned on. Open the Particle Mobile App and login to your particle account, if you have not already.

  4. On the "Your Devices" screen, click the "+" icon to add a new device.
  5. Select the "Mesh" option and choose the "Argon" option.
  6. The next screen will instruct you to find the data matrix printed on your Argon and scan it with your Phone's camera. Make sure to allow the app to access your camera to complete this step.
  7. The app will now use Bluetooth to pair with your device. If this is the first time your Argon is connected, it is probably due for a device OS update. This is handled automatically by the App. this may take some time, depending on the number of updates pending.
  8. After the update is complete the app will ask if you want to add the Argon to a mesh network. For now, select NO, DON'T USE IN MESH, as we will will explore the mesh networking capabilities later on.
  9. Connect your device to the cloud, by providing it with wifi. Select the WiFi you intend to use, and enter the password.
  10. When your device has connected successfully, you may give it a name. After that, exit the setup.

Congratulations, you've claimed your first Argon. Now, you'll program it to blink an LED.

Program your device

You will now flash firmware (hardware speak for sending code to a device) from the Particle Web IDE

  1. Go to the Particle Web IDE and login if you have not already.

  2. Create a new app by submitting a title (e.g. "blinky") and press enter.

  3. You should now have a right-side section (the code pane) with two empty functions declared. The goal is now to write code that turns the onboard blue LED on and off every second - a hardware equivalent of the classic "Hello world!".
  4. The physical pin connected to the blue LED is D7, we give it a name, so we can call it later on. Do this above the setup function.
    // Blink an LED.
    // Declare variables.
    int ledPin = D7; // The onboard blue LED is connected to pin D7.
    
  5. We now need to configure this pin as an output to be able to control the voltage (HIGH or LOW). This is done inside the setup function.
    // Set the pin mode to output, so we may control it.
    pinMode(ledPin, OUTPUT);
    
  6. Turn on the LED by setting the pin value to HIGH. This is done inside the loop function.
    // Turn on the LED.
    digitalWrite(ledPin, HIGH);
    
  7. To keep the LED on for a fixed amount of time before turning it off again, introduce a delay immediately after.
    // We'll leave it on for 1 second (1000milliseconds).
    delay(1000);
    
  8. Now turn the LED off by setting the pin value LOW.
    // Turn off the LED.
    digitalWrite(ledPin, LOW);
    
  9. To finalize the code, add a delay after turning the diode off, so it is off for a while, before the loop restarts and turns the diode back on again.

    // We'll leave it off for 1 second.
    delay(1000);
    

    The "blinky" code is now complete, and it is time to flash it to your physical device.

  10. Choose which device to target with this code by clicking the crosshair icon in the left pane.

  11. Your Argon should be on the list, if you have claimed it successfully. If it is online it will have a "breathing" cyan circle right of its name.

...and that's how you get to blinky!

Got stuck?
The final code for this lab is available here.