Introduction: Particle Core - Internet Button

In this tutorial I am going to show you how to get started with the Particle core internet button, the internet Button is a particle core shield, which has -

  • 12 RGB LEDs
  • 6 Axis accelerometer
  • Push buttons
  • Temperature sensor
  • Buzzer

This is a good shield to get started with projects, relating to the internet, like tweet by pushing a button or as tool to design 3D layouts. This is a beginners tutorial and in the upcoming tutorials I will show you how to make more complex projects.

So lets get started....

Step 1: Tools and Components

All that you need for this instructable is -

  • Spark Core
  • Internet Button

You can also get a photon which is cheaper than the particle core.

Step 2: Blink

In this instructable I'm going to show you how to blink an LED, the blink is like the Hello World of programming. You can run blink on any color but I'm trying a light blue colored tone.

You need to first connect the core to the internet, you can follow my previous instrucables as a guide on how to do that. The process is quite simple and once you got it connected to the internet it is now time to upload the program to it.

Note- I'm using an old version of the internet button, the new version includes a protective case and a buzzer.

Step 3: Code

You can copy the code below and upload it to the particle build IDE and flash it to the core. The program blinks the 6th LED.

<p>#include "InternetButton/InternetButton.h"</p><p>// Create a Button named b. It will be your friend, and you two will spend lots of time together.
// You may be wondering about those two slashes and this gray text- they're called comments, and
// don't affect the code. Think of this as the voice of the narrator.
InternetButton b = InternetButton();</p><p>// The code in setup() runs once when the device is powered on or reset. Used for setting up states, modes, etc
void setup() {
    // Tell b to get everything ready to go
    // Use b.begin(1); if you have the original SparkButton, which does not have a buzzer or a plastic enclosure
    // to use, just add a '1' between the parentheses in the code below.
    b.begin();
}</p><p>/* loop(), in contrast to setup(), runs all the time. Over and over again.
Remember this particularly if there are things you DON'T want to run a lot. Like Spark.publish() */
void loop() {
    // Let's turn an LED on. How about #6, which is at the 6 o'clock position? Let's make it blue and bright.
    b.ledOn(6, 0, 0, 255);
    // The format here is (LED, red, green, blue), so we're making a color with no red or green, but ALL the blue
    // You should know that the range of brightness here is 0-255, so 0 is off and 255 is the most possible.
    // After you use this code, try making the LED white- all the red, green, and blue.</p><p>    // Since the LED is now on, let's have it stay that way for one second
    // Delay pauses the code for the amount of time given, in milliseconds- so 1000 millis is one whole second
    delay(1000);</p><p>    // And to blink the LED, we'll need to turn it back off and then pause for another second
    b.ledOff(6);
    delay(1000);</p><p>    // Now you're blinking! Play with which LED is blinking (1-11), the delays between, and the color.
}</p>

Step 4: Multiple LEDs

Now one led is kind of boring time to blink multiple LEDs, the code is quite simple and almost same as that of the previous version.

Again, you can choose any color you like to blink the led, the color code is in RGB format.

Step 5: Code

This code blinks all the LEDs, with a delay of one second.

#include "InternetButton/InternetButton.h"

/* This SparkButton library has some useful functions.
Here we blink ALL the LEDs instead of just one.*/

InternetButton b = InternetButton();

void setup() { // Tell b to get everything ready to go // Use b.begin(1); if you have the original SparkButton, which does not have a buzzer or a plastic enclosure // to use, just add a '1' between the parentheses in the code below. b.begin(1); }

void loop(){ b.allLedsOn(0,20,20); delay(1000); b.allLedsOff(); delay(1000);

// Notice that I made them much dimmer, so it's a bit less painful }